This does not mean to be anonymous. Assigning a dynamically created class to a constant makes it a name:
Foo = Class.new
foo = Class.new
However, he still does not nest further:
module Bar
Baz = Module.new do
p Module.nesting
end
end
Or even about being dynamic:
module Quz
eval 'module Qux; p Module.nesting; end'
end
This is about the gates of the area.
As for the constants, there are only two shutters - the keywords classand module.
The attachment is purely syntactic. This is why you get weird:
module Do
X = 42
end
module Do
module Re
p Module.nesting
p X
end
end
module Do::Mi
p Module.nesting
p X
end
Do.module_eval { p X }
Do.instance_eval { p X }
, Ruby class module, " node". end, . , node.