Created
April 27, 2011 03:08
-
-
Save brianstorti/943648 to your computer and use it in GitHub Desktop.
Basic mixin example
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
module Debug | |
def who_am_i? | |
self.class.name | |
end | |
end | |
class A | |
include Debug | |
end | |
class B | |
include Debug | |
end | |
A.new.who_am_i? | |
B.new.who_am_i? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment