Created
November 11, 2008 14:47
-
-
Save ssoper/23867 to your computer and use it in GitHub Desktop.
ghost class
This file contains 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
irb(main):001:0> class Foo | |
irb(main):002:1> def ghost_class | |
irb(main):003:2> class << self | |
irb(main):004:3> self | |
irb(main):005:3> end | |
irb(main):006:2> end | |
irb(main):007:1> end | |
=> nil | |
irb(main):008:0> bar = Foo.new | |
=> #<Foo:0x871f4> | |
irb(main):009:0> bar.ghost_class | |
=> #<Class:#<Foo:0x871f4>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment