Created
January 12, 2012 17:34
-
-
Save skiz/1601944 to your computer and use it in GitHub Desktop.
Module#const_defined? weirdness in Ruby 1.9.3
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
mod = Module.new do | |
Junk = 123 | |
end | |
mod.const_defined?(:Junk) #=> false | |
mod.const_defined?(:Junk, false) #=> ArgumentError | |
mod.constants #=> [] | |
module Foo | |
Junk = 123 | |
end | |
Foo.const_defined?(:Junk) #=> true | |
Foo.const_defined?(:Junk, false) #=> ArgumentError | |
Foo.constants #=> ["Junk"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment