I just got stuck on this for a while. Take this base:
module Top class Test end module Foo end end
Later, I can define classes inside Foo that extend Test by doing this:
module Top module Foo class SomeTest < Test end end end
However, if I try to minimize indentation by using :: to indicate the module:
module Top::Foo class Failure < Test end end
This fails:
NameError: uninitialized constant Top :: Foo :: Test
Is this a mistake, or is it just a logical consequence of how Ruby resolves variable names?
Hubro source share