Namespaces in Ruby don’t work the way you seem to think.
There is no such thing as a “namespace method”. A::B#foo
is an instance method on the module A::B
—which is a module named B
in the namespace of A
.
Namespaces modules/classes have no special relationship of inheritance between them. They are purely organizational in nature, except when defined the long way (e.g. module A; module B; end; end
) when they can affect lexical scope.
If you want to get methods of A::B
in A::B::C
, you must include A::B
in A::B::C
, just like you would anywhere else. You have to do this because, as said above, there's nothing special about a namespaced module/class, it is treated the same as any other.