Skip to content

Instantly share code, notes, and snippets.

@takkanm
Created June 30, 2016 08:12
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 takkanm/2e62ab66ff9cb77a9207ccd3e709c55e to your computer and use it in GitHub Desktop.
Save takkanm/2e62ab66ff9cb77a9207ccd3e709c55e to your computer and use it in GitHub Desktop.
module Foo
def foo
super
p :foo
end
end
module Fuga
def foo
super
p :fuga
end
end
class Hoge
def foo
p :hoge
end
end
a = Hoge.new
a.extend Foo
a.extend Fuga
a.foo
puts '-----------------------------------'
b = Hoge.new
b.singleton_class.prepend Foo
b.extend Fuga
b.foo
> ruby foo.ruby
:hoge
:foo
:fuga
-----------------------------------
:hoge
:fuga
:foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment