public Method

Module.parent

Return the module which contains this one; if this is a root module, such as +::MyModule+, then Object is returned.

Source Code

# File active_support/core_ext/module/introspection.rb, line 4
def parent
  parent_name = name.split('::')[0..-2] * '::'
  parent_name.empty? ? Object : parent_name.constantize
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.