rubydiscoverability

Discovering Ruby object members?


What is an easy way to find out what methods/properties that a ruby object exposes?

As an example to get member information for a string, in PowerShell, you can do

"" | get-member

In Python,

dir("")

Is there such an easy way to discover member information of a Ruby object?


Solution

  • "foo".methods
    

    See:

    http://ruby-doc.org/core/classes/Object.html

    http://ruby-doc.org/core/classes/Class.html

    http://ruby-doc.org/core/classes/Module.html