Wednesday, January 31, 2007

Ruby - Code Snippet - Methods List

Just a snippet how to print out a sorted list of an object's methods.

puts "\n\object.methods : "+ object.methods.sort.join("\n").to_s+"\n\n"

5 comments:

Anonymous said...

Nice nice!

Jaydeep Dave said...

awesome..... really helped at the right time :)

Jaydeep Dave

Anonymous said...

this is cool, thanks!

Dave said...

In a Rails console you could also type:

Class.methods.sort

where "Class" is the class you are investigating.

Dave said...

er... I meant

y Class.methods.sort.