Created
January 27, 2010 17:51
-
-
Save meuble/288045 to your computer and use it in GitHub Desktop.
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 Actions | |
def toto | |
p "toto" | |
end | |
end | |
class Foo | |
end | |
Foo.new.toto | |
# => NoMethodError: undefined method `toto' for #<Foo:0x10f3808> | |
Foo.toto | |
# => NoMethodError: undefined method `toto' for Foo:Class | |
f = Foo.new | |
f.extend Actions | |
f.toto | |
# => "toto" | |
f2 = Foo.new | |
f2.toto | |
# => NoMethodError: undefined method `toto' for #<Foo:0x10ec968> | |
class Bar | |
include Actions | |
end | |
b = Bar.new | |
b.toto | |
# => "toto" | |
Bar.toto | |
# => NoMethodError: undefined method `toto' for Bar:Class | |
class Boz | |
extend Actions | |
end | |
Boz.toto | |
# => "toto" | |
bz = Boz.new | |
bz.toto | |
# => NoMethodError: undefined method `toto' for #<Boz:0x10dde90> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment