Search code examples
pythonruby

Ruby equivalent to Python's help()?


When working in interactive Python, I tend to rely on the built-in help() function to tell me what something expects and/or returns, and print out any documentation that might help me. Is there a Ruby equivalent to this function?

I'm looking for something I could use in irb. For example, in interactive Python I could type:

>>> help(1)

which would then print

Help on int object:

class int(object)  |  int(x[, base])
-> integer  |    |  

Convert a string or number to an integer, if possible. A ...

Solution

  • You can also use ri from within irb. I'd recommend the wirble gem as an easy way to set this up.