Skip to content

Instantly share code, notes, and snippets.

@robertjwhitney
Created March 25, 2013 21:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertjwhitney/5240994 to your computer and use it in GitHub Desktop.
Save robertjwhitney/5240994 to your computer and use it in GitHub Desktop.
class Object
# Return a list of methods defined locally for a particular object. Useful
# for seeing what it does whilst losing all the guff that's implemented
# by its parents (eg Object).
def local_methods(obj = self)
(obj.methods - obj.class.superclass.instance_methods).sort
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment