From: danieldasilvaferreira@... Date: 2016-05-15T12:58:26+00:00 Subject: [ruby-core:75515] [Ruby trunk Feature#12317] Name space of a module Issue #12317 has been updated by Daniel Ferreira. Hi Tsuyoshi. A clear namespace definition is important for the implementation of my proposed feature: [internal interface](https://bugs.ruby-lang.org/issues/9992) In fact I was thinking in proposing such a similar method. Following the challenge put by J��rg W Mittag [internal - note#5](https://bugs.ruby-lang.org/issues/9992#note-5) What in your opinion should be the output of #namespace for the challenges pointed out by J��rg? Simple challenge example: ~~~ ruby module Foo class Bar end end Baz = Foo ::Baz::Bar.ancestors => [Foo::Bar, Object, Kernel, BasicObject] ::Baz::Bar.namespace => ? ~~~ ---------------------------------------- Feature #12317: Name space of a module https://bugs.ruby-lang.org/issues/12317#change-58631 * Author: Tsuyoshi Sawada * Status: Open * Priority: Normal * Assignee: ---------------------------------------- I want a method to return the name space of a module, something like: ~~~ruby class A; module B; module C end end end A::B::C.namespace => [A, A::B, A::B::C] ~~~ There is `nesting` method that is similar, but that only returns the lexical nesting information. There are also some known hacks for this, converting the module to the string representation using `to_s` or `name`, and then splitting it by `::`. But that easily breaks if the module is anonymous, or is a singleton module. I would like a more robust, core method. -- https://bugs.ruby-lang.org/ Unsubscribe: