Skip to content

Instantly share code, notes, and snippets.

@britishtea
Created August 10, 2013 21:28
Show Gist options
  • Save britishtea/6202211 to your computer and use it in GitHub Desktop.
Save britishtea/6202211 to your computer and use it in GitHub Desktop.
module Mixin
def foo
puts "foo"
end
end
class A; end
a = A.new
a.foo # => NoMethodError
a.extend(Mixin)
a.foo # => "foo"
class B
include Mixin
# ...
end
b = B.new
b.foo # => "foo"
class C
extend Mixin
end
c = C.new
c.foo # => NoMethodError
C.foo # => "foo"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment