Class: DSLCompose::DSL::Arguments::Argument::IsAValidation
- Inherits:
-
Object
- Object
- DSLCompose::DSL::Arguments::Argument::IsAValidation
- Defined in:
- lib/dsl_compose/dsl/arguments/argument/is_a_validation.rb
Defined Under Namespace
Classes: ValidationFailedError
Instance Method Summary collapse
-
#initialize(value) ⇒ IsAValidation
constructor
A new instance of IsAValidation.
- #validate!(value) ⇒ Object
Constructor Details
#initialize(value) ⇒ IsAValidation
Returns a new instance of IsAValidation.
11 12 13 |
# File 'lib/dsl_compose/dsl/arguments/argument/is_a_validation.rb', line 11 def initialize value @value = value end |
Instance Method Details
#validate!(value) ⇒ Object
15 16 17 18 |
# File 'lib/dsl_compose/dsl/arguments/argument/is_a_validation.rb', line 15 def validate! value raise ValidationFailedError, "The argument is invalid. Expected #{value} to be an instance of #{@value}" unless value.is_a?(@value) true end |