Class: DSLCompose::DSL::Arguments::Argument::EqualToValidation

Inherits:
Object
  • Object
show all
Defined in:
lib/dsl_compose/dsl/arguments/argument/equal_to_validation.rb

Defined Under Namespace

Classes: ValidationFailedError

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ EqualToValidation

Returns a new instance of EqualToValidation.



11
12
13
# File 'lib/dsl_compose/dsl/arguments/argument/equal_to_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/equal_to_validation.rb', line 15

def validate! value
  raise ValidationFailedError, "The argument is invalid. Expected #{@value} but received #{value}" unless value == @value
  true
end