instance method
parent_name
Ruby on Rails 5.2.8.1
Since v3.0.20 Last seen in v6.0.6Signature
parent_name()
Returns the name of the module containing this one.
M::N.parent_name # => "M"
Source
# File activesupport/lib/active_support/core_ext/module/introspection.rb, line 9
def parent_name
if defined?(@parent_name)
@parent_name
else
parent_name = name =~ /::[^:]+\Z/ ? $`.freeze : 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