这是原始SO问题的延续:使用"::"而不是"module ..."来表示Ruby命名空间
在最初的SO问题中,这里是我仍然无法理解的情景:
FOO = 123
module Foo
FOO = 555
end
module Foo
class Bar
def baz
puts FOO
end
end
end
class Foo::Bar
def glorf
puts FOO
end
end
puts Foo::Bar.new.baz # -> 555
puts Foo::Bar.new.glorf # -> 123
Run Code Online (Sandbox Code Playgroud)
有人可以提供一些解释为什么第一个呼叫返回555以及为什么第二个呼叫返回123?