Created
October 3, 2009 07:34
-
-
Save rjungemann/200465 to your computer and use it in GitHub Desktop.
The Object#grok method, for exploring Ruby objects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# the grok method - shows a list of "interesting" methods for an object | |
# usage - "hello".grok | |
# => ["%", "*", "+", "<<", "[]", "[]=", "all?", "any?", ...] | |
class Object | |
def grok | |
(self.methods - Object.new.methods).sort | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment