Class: Aws::Templates::Utils::Parametrized::Constraint::AllOf

Inherits:
Aws::Templates::Utils::Parametrized::Constraint show all
Defined in:
lib/aws/templates/utils/parametrized/constraint/all_of.rb

Overview

Aggregate constraint

It is used to perform checks against a list of constraints-functors or lambdas.

Example

class Piece
  include Aws::Templates::Utils::Parametrized
  parameter :param1,
    :constraint => all_of(
      not_nil,
      satisfies("Should be moderate") { |v| v < 100 }
    )
end

i = Piece.new(:param1 => nil)
i.param1 # raise ParameterValueInvalid
i = Piece.new(:param1 => 200)
i.param1 # raise ParameterValueInvalid with description
i = Piece.new(:param1 => 50)
i.param1 # => 50

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Aws::Templates::Utils::Parametrized::Constraint

#check_wrapper, #if, #pre_condition, #to_proc

Constructor Details

#initialize(constraints) ⇒ AllOf

Returns a new instance of AllOf.



34
35
36
37
# File 'lib/aws/templates/utils/parametrized/constraint/all_of.rb', line 34

def initialize(constraints)
  @constraints = constraints
  self.if(Parametrized.any)
end

Instance Attribute Details

#constraintsObject (readonly)

Returns the value of attribute constraints.



32
33
34
# File 'lib/aws/templates/utils/parametrized/constraint/all_of.rb', line 32

def constraints
  @constraints
end