Class: Oval::SubclassOf
- Inherits:
-
ClassDeclBase
- Object
- Base
- ClassDeclBase
- Oval::SubclassOf
- Defined in:
- lib/oval/subclass_of.rb
Instance Attribute Summary
Attributes inherited from ClassDeclBase
Instance Method Summary collapse
Methods inherited from ClassDeclBase
Methods inherited from Base
[], ensure_equal, ensure_match, #initialize
Constructor Details
This class inherits a constructor from Oval::ClassDeclBase
Instance Method Details
#validate(thing, subject = nil) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/oval/subclass_of.rb', line 4 def validate(thing, subject = nil) unless thing.is_a?(Class) and (thing < self.klass) raise Oval::ValueError, "Invalid class #{thing.inspect}#{for_subject(subject)}. " + "Should be subclass of #{klass.name}" end end |