Published in: Ruby
URL: http://wiki.m001.net/technical/show/.irbrc
This allows you to search any INSTANCE or CLASS methods of any objects including rails models, which is helpful if you want to see the methods that you created yourself.
#drop this in .irbrc class Object def search_methods(string) search_results = ["--","CLASS METHODS","--"] search_results << self.methods.find_all{ |i| i.match(/#{string}/) }.sort search_results << ["--", "INSTANCE METHODS","--"] search_results << self.instance_methods.find_all{ |i| i.match(/#{string}/) }.sort return y(search_results) end end # now just call #Object.search_methods "your_search" in irb to find a method
You need to login to post a comment.
