Skip to content

Instantly share code, notes, and snippets.

@p8
Created September 29, 2010 22:16
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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