Quantcast
Channel: December 2010 – End of Line
Viewing all articles
Browse latest Browse all 10

Getting Help Inside IRB

$
0
0

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}`
  end

Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles



Latest Images