Created
September 5, 2012 03:40
-
-
Save robb1e/3629987 to your computer and use it in GitHub Desktop.
Include and Extend Ruby mixin
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 Foo | |
def say | |
'foo' | |
end | |
end | |
module Bar | |
def say | |
'bar' | |
end | |
end | |
class Baz | |
include Foo | |
end | |
baz = Baz.new | |
puts baz.say | |
bazzer = Baz.new | |
bazzer.extend(Bar) | |
puts bazzer.say |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment