RSS

Ruby tricks

11 Oct

A short little method that helps find methods up the class latter:

class Object
  def my_methods
    self.class.ancestors.each {|anc|
      puts "#{anc}:"
      p anc.instance_methods(false)
      puts
    }
  end
end
5.times.my_methods

It was copied from Stupid easy Ruby tricks

Advertisements
 
1 Comment

Posted by on October 11, 2006 in Ruby/Rails

 

One response to “Ruby tricks

  1. tovorinok

    July 5, 2007 at 4:09 am

    Hello

    Great book. I just want to say what a fantastic thing you are doing! Good luck!

    Bye

     

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

 
%d bloggers like this: