Last active
September 15, 2017 10:34
-
-
Save kalorz/7d6130a662ecc18a832408f546bf5583 to your computer and use it in GitHub Desktop.
Ruby Gotchas: Lexical Scope vs Inheritance
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
MY_SCOPE = 'Global' | |
module Foo | |
MY_SCOPE = 'Foo Module' | |
class Bar | |
def scope1 | |
puts MY_SCOPE | |
end | |
end | |
end | |
class Foo::Bar | |
def scope2 | |
puts MY_SCOPE | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment