Class: Dry::Validation::Rule::Set
Instance Attribute Summary
#name, #predicate
Instance Method Summary
collapse
#and, #curry, #initialize, #or, #then
Instance Method Details
#at(*args) ⇒ Object
12
13
14
|
# File 'lib/dry/validation/rule/set.rb', line 12
def at(*args)
self.class.new(name, predicate.values_at(*args))
end
|
#call(input) ⇒ Object
4
5
6
|
# File 'lib/dry/validation/rule/set.rb', line 4
def call(input)
Validation.Result(input, predicate.map { |rule| rule.(input) }, self)
end
|
#to_ary ⇒ Object
Also known as:
to_a
16
17
18
|
# File 'lib/dry/validation/rule/set.rb', line 16
def to_ary
[type, [name, predicate.map(&:to_ary)]]
end
|
#type ⇒ Object
8
9
10
|
# File 'lib/dry/validation/rule/set.rb', line 8
def type
:set
end
|