Class: Dry::Validation::Schema::Definition::Rule
- Inherits:
-
Object
- Object
- Dry::Validation::Schema::Definition::Rule
- Defined in:
- lib/dry/validation/schema/rule.rb
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Returns the value of attribute node.
Instance Method Summary collapse
- #&(other) ⇒ Object
-
#initialize(node) ⇒ Rule
constructor
A new instance of Rule.
- #to_ary ⇒ Object (also: #to_a)
- #|(other) ⇒ Object
Constructor Details
#initialize(node) ⇒ Rule
Returns a new instance of Rule.
8 9 10 |
# File 'lib/dry/validation/schema/rule.rb', line 8 def initialize(node) @node = node end |
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
6 7 8 |
# File 'lib/dry/validation/schema/rule.rb', line 6 def node @node end |
Instance Method Details
#&(other) ⇒ Object
17 18 19 |
# File 'lib/dry/validation/schema/rule.rb', line 17 def &(other) self.class.new([:and, [node, other.to_ary]]) end |
#to_ary ⇒ Object Also known as: to_a
12 13 14 |
# File 'lib/dry/validation/schema/rule.rb', line 12 def to_ary node end |
#|(other) ⇒ Object
21 22 23 |
# File 'lib/dry/validation/schema/rule.rb', line 21 def |(other) self.class.new([:or, [node, other.to_ary]]) end |