Created
January 17, 2011 20:52
-
-
Save jpr5/783465 to your computer and use it in GitHub Desktop.
[ruby 1.8.7] nested namespaces need physical nesting for const_missing? to work
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
#!/usr/bin/ruby | |
class Balls | |
BALLS = 1 | |
end | |
class Balls::Dongs | |
def doit | |
puts "balls = #{BALLS}" | |
end | |
end | |
Balls::Dongs.new.doit | |
__END__ | |
$ ruby test.rb | |
/tmp/test.rb:9:in `doit': uninitialized constant Balls::Dongs::BALLS (NameError) | |
from /tmp/test.rb:13 | |
$ |
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
#!/usr/bin/ruby | |
class Balls | |
BALLS = 1 | |
end | |
class Balls | |
class Dongs | |
def doit | |
puts "balls = #{BALLS}" | |
end | |
end | |
end | |
Balls::Dongs.new.doit | |
__END__ | |
$ ruby test.rb | |
balls = 1 | |
$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment