Class: Dry::Validation::Schema::Rule
- Inherits:
-
Object
- Object
- Dry::Validation::Schema::Rule
- Defined in:
- lib/dry/validation/schema/rule.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#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.
7 8 9 |
# File 'lib/dry/validation/schema/rule.rb', line 7 def initialize(node) @node = node end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/dry/validation/schema/rule.rb', line 5 def name @name end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
5 6 7 |
# File 'lib/dry/validation/schema/rule.rb', line 5 def node @node end |
Instance Method Details
#&(other) ⇒ Object
16 17 18 |
# File 'lib/dry/validation/schema/rule.rb', line 16 def &(other) self.class.new([:and, [node, other.to_ary]]) end |
#to_ary ⇒ Object Also known as: to_a
11 12 13 |
# File 'lib/dry/validation/schema/rule.rb', line 11 def to_ary node end |
#|(other) ⇒ Object
20 21 22 |
# File 'lib/dry/validation/schema/rule.rb', line 20 def |(other) self.class.new([:or, [node, other.to_ary]]) end |