Class: Aws::Templates::Utils::Parametrized::Constraint::AllOf
- Inherits:
-
Aws::Templates::Utils::Parametrized::Constraint
- Object
- Aws::Templates::Utils::Parametrized::Constraint
- Aws::Templates::Utils::Parametrized::Constraint::AllOf
- 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
-
#constraints ⇒ Object
readonly
Returns the value of attribute constraints.
Instance Method Summary collapse
-
#initialize(constraints) ⇒ AllOf
constructor
A new instance of AllOf.
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
#constraints ⇒ Object (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 |