Class: Dry::Logic::Rule::Set
Instance Attribute Summary
#options, #predicate
Instance Method Summary
collapse
Methods inherited from Value
#call, #evaluate
#and, #curry, #each?, #initialize, #negation, #new, #or, #predicate_id, #then, #xor
Instance Method Details
#apply(input) ⇒ Object
10
11
12
|
# File 'lib/dry/logic/rule/set.rb', line 10
def apply(input)
rules.map { |rule| rule.(input) }
end
|
#at(*args) ⇒ Object
14
15
16
|
# File 'lib/dry/logic/rule/set.rb', line 14
def at(*args)
new(rules.values_at(*args))
end
|
#to_ast ⇒ Object
18
19
20
|
# File 'lib/dry/logic/rule/set.rb', line 18
def to_ast
[type, rules.map { |rule| rule.to_ast }]
end
|
#type ⇒ Object
6
7
8
|
# File 'lib/dry/logic/rule/set.rb', line 6
def type
:set
end
|