Skip to content

Instantly share code, notes, and snippets.

@hassox
Created May 12, 2010 06:06
Show Gist options
  • Select an option

  • Save hassox/398268 to your computer and use it in GitHub Desktop.

Select an option

Save hassox/398268 to your computer and use it in GitHub Desktop.
module MMixer
def m
puts "Mixing In M"
self.class.class_eval do
include M
end
m
end
end
module M
def m
puts "m in M"
end
end
class Foo
include MMixer
end
>> foo = Foo.new
=> #<Foo:0x1016685f8>
>> foo.m
Mixing In M
m in M
=> nil
>> foo.m
m in M
=> nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment