/ Published in: Ruby
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.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#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
URL: http://wiki.m001.net/technical/show/.irbrc