Created
May 12, 2010 06:06
-
-
Save hassox/398268 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| module MMixer | |
| def m | |
| puts "Mixing In M" | |
| self.class.class_eval do | |
| include M | |
| end | |
| m | |
| end | |
| end | |
| module M | |
| def m | |
| puts "m in M" | |
| end | |
| end | |
| class Foo | |
| include MMixer | |
| end | |
| >> foo = Foo.new | |
| => #<Foo:0x1016685f8> | |
| >> foo.m | |
| Mixing In M | |
| m in M | |
| => nil | |
| >> foo.m | |
| m in M | |
| => nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment