Created
May 2, 2014 07:03
-
-
Save jobwat/ca9cc1ca2d097869f9f8 to your computer and use it in GitHub Desktop.
Constant lookup limitation in Ruby
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
class Foo | |
def self.showConstant | |
puts CONSTANT | |
end | |
end | |
class SubFoo < Foo | |
CONSTANT='SubFoo string' | |
end | |
SubFoo.showConstant |
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 CONSTANT.rb | |
CONSTANT.rb:3:in `showConstant': uninitialized constant Foo::CONSTANT (NameError) | |
from CONSTANT.rb:10:in `<main>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment