instance method
module_parent
Ruby on Rails edge
Since v6.0.6.1Signature
module_parent()
Returns the module which contains this one according to its name.
“‘ module M
module N
end
end X = M::N
M::N.module_parent # => M X.module_parent # => M “‘
The parent of top-level and anonymous modules is Object.
“‘ M.module_parent # => Object Module.new.module_parent # => Object “`
Source
# File activesupport/lib/active_support/core_ext/module/introspection.rb, line 44
def module_parent
module_parent_name ? ActiveSupport::Inflector.constantize(module_parent_name) : Object
end
Defined in activesupport/lib/active_support/core_ext/module/introspection.rb line 44
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Module