Module: Utils::IRB::Module

Included in:
Module
Defined in:
lib/utils/irb.rb

Instance Method Summary collapse

Instance Method Details

#ri(pattern = nil) ⇒ Object

Start ri for module#pattern, trying to find a method matching pattern for all modules in the ancestors chain of this module.



398
399
400
401
402
403
404
405
406
407
408
409
410
411
# File 'lib/utils/irb.rb', line 398

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