How to know what methods are available to an object in ruby

I was wondering if there was a plug-in for irb that allowed you to interrogate what methods were available to an object, but I found out thanks to the #ruby-lang channel on irc by Archiloque and drbrain, you can ask the object directly with the following code; my_object.public_methods.sort

Update: After a quick google search, found this stackoverflow.

Update: OOo, this even gets better, people are really willing to help, if only you ask. User “Kenichi” on #ruby irc gave this tip for tab completion in irb;

“raluxgaza: i have “require ‘irb/completion'” in my ~/.irbrc and i can hit tab-tab after a ‘Object.’ and it spits out all Object’s methods, similar to bash.”. Another sweet tip.

Then they suggested this gem


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s