module Utils::IRB::Module

def ri(pattern = nil)

for all modules in the ancestors chain of this module.
Start +ri+ for +module#pattern+, trying to find a method matching +pattern+
def ri(pattern = nil)
  if pattern
    pattern = pattern.to_sym.to_s if pattern.respond_to? :to_sym
    ancestors.each do |a|
      if method = a.instance_methods(false).find { |m| pattern === m }
        a = Object if a == Kernel # ri seems to be confused
        system "ri #{a}##{method} | #{$pager}"
      end
    end
  else
    system "ri #{self} | #{$pager}"
  end
  return
end