Class: Dry::Validation::Rule::Composite
- Inherits:
-
Dry::Validation::Rule
- Object
- Dry::Validation::Rule
- Dry::Validation::Rule::Composite
- Defined in:
- lib/dry/validation/rule/composite.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#left ⇒ Object
readonly
Returns the value of attribute left.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#right ⇒ Object
readonly
Returns the value of attribute right.
Attributes inherited from Dry::Validation::Rule
Instance Method Summary collapse
-
#initialize(left, right) ⇒ Composite
constructor
A new instance of Composite.
- #to_ary ⇒ Object (also: #to_a)
Methods inherited from Dry::Validation::Rule
Constructor Details
#initialize(left, right) ⇒ Composite
Returns a new instance of Composite.
8 9 10 11 12 |
# File 'lib/dry/validation/rule/composite.rb', line 8 def initialize(left, right) @name = left.name @left = left @right = right end |
Instance Attribute Details
#left ⇒ Object (readonly)
Returns the value of attribute left.
6 7 8 |
# File 'lib/dry/validation/rule/composite.rb', line 6 def left @left end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/dry/validation/rule/composite.rb', line 6 def name @name end |
#right ⇒ Object (readonly)
Returns the value of attribute right.
6 7 8 |
# File 'lib/dry/validation/rule/composite.rb', line 6 def right @right end |
Instance Method Details
#to_ary ⇒ Object Also known as: to_a
14 15 16 |
# File 'lib/dry/validation/rule/composite.rb', line 14 def to_ary [type, [left.to_ary, right.to_ary]] end |