Skip to content

Instantly share code, notes, and snippets.

@p8
Created September 29, 2010 22:16
Show Gist options
  • Save p8/603673 to your computer and use it in GitHub Desktop.
Save p8/603673 to your computer and use it in GitHub Desktop.
String.class_eval { def instance_method; "instance method"; end }
String.class.class_eval { def class_method; "class method"; end }
String.class.class.class_eval { def eigenclass_method; "eigenclass method"; end }
"a".instance_method # => "instance method"
String.class_method # => "class method"
class X < String
eigenclass_method
end # => "eigenclass method"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment