Class: DSLCompose::DSL::Arguments::Argument::GreaterThanValidation
- Inherits:
-
Object
- Object
- DSLCompose::DSL::Arguments::Argument::GreaterThanValidation
- Defined in:
- lib/dsl_compose/dsl/arguments/argument/greater_than_validation.rb
Defined Under Namespace
Classes: InvalidValueError, ValidationFailedError
Instance Method Summary collapse
-
#initialize(value) ⇒ GreaterThanValidation
constructor
A new instance of GreaterThanValidation.
- #validate!(value) ⇒ Object
Constructor Details
#initialize(value) ⇒ GreaterThanValidation
Returns a new instance of GreaterThanValidation.
14 15 16 17 18 19 20 |
# File 'lib/dsl_compose/dsl/arguments/argument/greater_than_validation.rb', line 14 def initialize value unless value.is_a?(Numeric) raise InvalidValueError, "The value `#{value}` provided to this validator must be of type number" end @value = value end |
Instance Method Details
#validate!(value) ⇒ Object
22 23 24 25 |
# File 'lib/dsl_compose/dsl/arguments/argument/greater_than_validation.rb', line 22 def validate! value raise ValidationFailedError, "The argument is invalid. Expected greater than #{@value} but received #{value}" unless value > @value true end |