From: sawadatsuyoshi@... Date: 2016-05-07T12:25:51+00:00 Subject: [ruby-core:75405] [Ruby trunk Feature#12317] Name space of a module Issue #12317 has been updated by Tsuyoshi Sawada. I realized that the order of modules that I wrote in the expected output is not in accordance with methods like `nesting` or `ancestors` (which go from self to the modules that are farther). So perhaps, the following may be better: ~~~ruby A::B::C.namespace => [A::B::C, A::B, A] ~~~ ---------------------------------------- Feature #12317: Name space of a module https://bugs.ruby-lang.org/issues/12317#change-58528 * 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: