Method: Module#parent

Defined in:
motion/core_ext/module/introspection.rb

#parentObject

Returns the module which contains this one according to its name.

module M
  module N
  end
end
X = M::N

M::N.parent # => M
X.parent    # => M

The parent of top-level and anonymous modules is Object.

M.parent          # => Object
Module.new.parent # => Object


28
29
30
# File 'motion/core_ext/module/introspection.rb', line 28

def parent
  parent_name ? parent_name.constantize : Object
end