Class: Oval::InstanceOf
- Inherits:
-
ClassDeclBase
- Object
- Base
- ClassDeclBase
- Oval::InstanceOf
- Defined in:
- lib/oval/instance_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(object, subject = nil) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/oval/instance_of.rb', line 4 def validate(object, subject = nil) unless object.instance_of?(klass) raise Oval::ValueError, "Invalid object #{object.inspect} of type #{object.class.name}" + "#{for_subject(subject)}. Should be an instance of #{klass.name}" end end |