Class: Dry::Logic::Rule::Value
Instance Attribute Summary
#options, #predicate
Instance Method Summary
collapse
#and, #curry, #each?, #initialize, #negation, #new, #or, #predicate_id, #then, #xor
Instance Method Details
#apply(input) ⇒ Object
12
13
14
|
# File 'lib/dry/logic/rule/value.rb', line 12
def apply(input)
predicate.(evaluate(input))
end
|
#call(input) ⇒ Object
8
9
10
|
# File 'lib/dry/logic/rule/value.rb', line 8
def call(input)
Logic.Result(apply(input), self, input)
end
|
#evaluate(input) ⇒ Object
16
17
18
|
# File 'lib/dry/logic/rule/value.rb', line 16
def evaluate(input)
input
end
|
#to_ast ⇒ Object
20
21
22
|
# File 'lib/dry/logic/rule/value.rb', line 20
def to_ast
[type, predicate.to_ast]
end
|
#type ⇒ Object
4
5
6
|
# File 'lib/dry/logic/rule/value.rb', line 4
def type
:val
end
|