Class: Class

Inherits:
Object show all
Defined in:
lib/bake/extensions/class.rb

Instance Method Summary collapse

Instance Method Details

#inherits?(ancestor) ⇒ Boolean

Returns true if self inherits from ancestor

Returns:

  • (Boolean)


3
4
5
6
7
8
9
10
# File 'lib/bake/extensions/class.rb', line 3

def inherits?(ancestor)
    sup = self
    while sup
        return true if sup.equal?(ancestor)
        sup = sup.superclass
    end
    return false
end