Last active
August 29, 2015 14:02
-
-
Save lmarburger/4a04de077b6c8a0805dd to your computer and use it in GitHub Desktop.
I always assumed `class Outer::Inner` was a synonym for `class Outer; class Inner`
This file contains hidden or 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
class Outer | |
A = 'outer' | |
end | |
puts Outer::A #=> outer | |
class Outer | |
class Inner | |
puts A #=> outer | |
end | |
end | |
class Outer::Inner | |
puts A | |
# const_lookup.rb:13:in `<class:Inner>': uninitialized constant Outer::Inner::A (NameError) | |
# from const_lookup.rb:12:in `<main>' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Me too. This is interesting.