Bug #15758
Updated by dux (Dino Reic) over 5 years ago
in short https://i.imgur.com/qvIIBuu.png Object.const_defined?('Baz::Bar') -> true yet Baz::Bar -> class not found! test to run, all ok on ruby 2.6.0, bug in 2.6.2 ~~~ruby ### class Foo end class Bar end class Baz class Foo end end ### def report klass name = "Object.const_defined?('%s')" % klass exists = Object.const_defined?(klass) instance = eval klass rescue nil check = (exists && instance) || (!exists && !instance)? 'ok' : 'ERROR!' puts [ name.ljust(35), exists.to_s.ljust(5), (instance ? instance.to_s : 'nil').ljust(8), check ].join(' -> ') end report 'Foo' report 'Bar' report 'Baz' report 'Naat' report 'Baz::Foo' report 'Baz::Bar' report 'Baz::Naat' puts '---' report 'Baz::Foo::Bar::Baz::Foo' # true in 2.6.2 :) ~~~