Created
November 12, 2010 19:18
-
-
Save bretweinraub/674529 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo < ActiveRecord::Base | |
end | |
class Class | |
def inherits_from?(klass) | |
raise ArgumentError.new("argument must be of type Class") unless klass.is_a? Class | |
if klass == self | |
true | |
elsif self.superclass.is_a? Class | |
self.superclass.inherits_from? klass | |
else | |
false | |
end | |
end | |
end | |
Foo.inherits_from? ActiveRecord::Base |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment