instance method
module_parent_name
Ruby on Rails 8.1.2
Since v6.0.6Signature
module_parent_name()
Returns the name of the module containing this one.
M::N.module_parent_name # => "M"
Source
# File activesupport/lib/active_support/core_ext/module/introspection.rb, line 9
def module_parent_name
if defined?(@parent_name)
@parent_name
else
name = self.name
return if name.nil?
parent_name = name =~ /::[^:]+\z/ ? -$` : nil
@parent_name = parent_name unless frozen?
parent_name
end
end
Defined in activesupport/lib/active_support/core_ext/module/introspection.rb line 9
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Module