Getting Help Inside IRB

Here’s a quick tip, ruby’s ri utility will look up documentation about a method. For instance you can type ri String#split to see the documentation for String’s instance method split. If you have an irb session open you can tell irb to shell out using back ticks like this:

  ruby-1.9.1-p378 > puts `ri String#split`

You can also make a little helper method like this:

  def ri(signature)
    puts `ri #{signature}`

Leave a comment

Filed under Uncategorized

Comments are closed.