Top Level Namespace

Defined Under Namespace

Modules: Magic

Instance Method Summary collapse

Instance Method Details

#help(*args, &block) ⇒ Object

help is a Do-What-I-Mean help function. It can be called with either a block or a single argument. When called with single argument, it behaves like normal help function, except for being much smarter:

help "Array"         - help on Array
help "Array#sort"    - help on Array#sort
help "File#sync="    - help on IO#sync=

help { [].sort }     - help on Array#sort
help { obj.foo = 1 } - help on obj.foo=
help { Array }       - help on Array
help { [] }          - help on Array
help { Dir["*"] }    - help on Dir::[]


25
26
27
28
# File 'lib/magic/help/irb.rb', line 25

def help(*args, &block)
  query = Magic::Help.resolve_help_query(*args, &block)
  irb_help(query) if query
end