public Method

Module.parents

Return all the parents of this module, ordered from nested outwards. The receiver is not contained within the result.

Source Code

# File active_support/core_ext/module/introspection.rb, line 11
def parents
  parents = []
  parts = name.split('::')[0..-2]
  until parts.empty?
    parents << (parts * '::').constantize
    parts.pop
  end
  parents << Object unless parents.include? Object
  parents
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.