Created
June 19, 2014 09:26
-
-
Save nedzadarek/e651c16b6e768b8f30df to your computer and use it in GitHub Desktop.
`extend self` vs `extend A::B`
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 A | |
# evil module: | |
module A | |
module B | |
def foo | |
:evil_foo | |
end | |
end | |
end | |
# good module: | |
module B | |
def foo | |
:good_foo | |
end | |
extend A::B | |
end | |
end | |
A::B.foo | |
# => :evil_foo | |
# it is not :good_foo! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment