Class: Class

Inherits:
Object show all
Defined in:
lib/utilrb/module/ancestor_p.rb

Instance Method Summary collapse

Instance Method Details

#has_ancestor?(klass) ⇒ Boolean

:nodoc:

Returns:

  • (Boolean)


8
9
10
11
12
13
14
15
16
# File 'lib/utilrb/module/ancestor_p.rb', line 8

def has_ancestor?(klass) # :nodoc:
    # We first test
    #   self <= class
    # as self.superclass goes to the next *CLASS* in the chain, i.e. skips
    # included modules
    #
    # Then, the superclass test is used in case +self+ is a singleton
    self <= klass || (superclass <= klass)
end