Skip to content

Instantly share code, notes, and snippets.

@fuse
Created May 31, 2011 11:11
Show Gist options
  • Select an option

  • Save fuse/1000319 to your computer and use it in GitHub Desktop.

Select an option

Save fuse/1000319 to your computer and use it in GitHub Desktop.
p garfield.class
# Cat
p garfield.class.ancestors
# [Cat, Animal, Object, Kernel]
p garfield.methods.sort
# ["==", "===", "=~", "__id__", "__send__", "age", "age=", "bigger?", "class", "clone", "display", "dup", "enum_for", "eql?", "equal?", "extend", "freeze", "frozen?", "hash", "id", "inspect", "instance_eval", "instance_exec", "instance_of?", "instance_variable_defined?", "instance_variable_get", "instance_variable_set", "instance_variables", "is_a?", "kind_of?", "method", "methods", "name", "name=", "nil?", "object_id", "older?", "private_methods", "protected_methods", "public_methods", "respond_to?", "send", "singleton_methods", "taint", "tainted?", "tap", "to_a", "to_enum", "to_s", "type", "untaint", "weight="]
p garfield.methods(false)
# []
# Object.const_get("RUBY_VERSION")
p garfield.class.ancestors.last.const_get("RUBY_VERSION")
# 1.8.7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment