Created
June 30, 2016 08:12
-
-
Save takkanm/2e62ab66ff9cb77a9207ccd3e709c55e 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 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 |
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
> 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