Skip to content

Instantly share code, notes, and snippets.

@meuble
Created January 27, 2010 17:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meuble/288045 to your computer and use it in GitHub Desktop.
Save meuble/288045 to your computer and use it in GitHub Desktop.
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