Class: Dry::Validation::Rule::Composite
- Inherits:
-
Object
- Object
- Dry::Validation::Rule::Composite
- Defined in:
- lib/dry/validation/rule.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.
Instance Method Summary collapse
-
#initialize(left, right) ⇒ Composite
constructor
A new instance of Composite.
- #to_ary ⇒ Object (also: #to_a)
Constructor Details
#initialize(left, right) ⇒ Composite
Returns a new instance of Composite.
37 38 39 40 41 |
# File 'lib/dry/validation/rule.rb', line 37 def initialize(left, right) @name = left.name @left = left @right = right end |
Instance Attribute Details
#left ⇒ Object (readonly)
Returns the value of attribute left.
35 36 37 |
# File 'lib/dry/validation/rule.rb', line 35 def left @left end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
35 36 37 |
# File 'lib/dry/validation/rule.rb', line 35 def name @name end |
#right ⇒ Object (readonly)
Returns the value of attribute right.
35 36 37 |
# File 'lib/dry/validation/rule.rb', line 35 def right @right end |
Instance Method Details
#to_ary ⇒ Object Also known as: to_a
43 44 45 |
# File 'lib/dry/validation/rule.rb', line 43 def to_ary [type, left.to_ary, [right.to_ary]] end |