class Dry::Logic::Operations::Check
Attributes
evaluator[R]
Public Class Methods
new(rule, **options)
click to toggle source
Calls superclass method
# File lib/dry/logic/operations/check.rb, line 9 def self.new(rule, **options) if options[:evaluator] super(rule, **options) else keys = options.fetch(:keys) evaluator = Evaluator::Set.new(keys) super(rule, **options, evaluator: evaluator) end end
new(*rules, **options)
click to toggle source
Calls superclass method
# File lib/dry/logic/operations/check.rb, line 20 def initialize(*rules, **options) super @evaluator = options[:evaluator] end
Public Instance Methods
[](input)
click to toggle source
# File lib/dry/logic/operations/check.rb, line 40 def [](input) rule[*evaluator[input].reverse] end
ast(input = Undefined)
click to toggle source
# File lib/dry/logic/operations/check.rb, line 44 def ast(input = Undefined) [type, [options[:keys], rule.ast(input)]] end
call(input)
click to toggle source
# File lib/dry/logic/operations/check.rb, line 29 def call(input) *head, tail = evaluator[input] result = rule.curry(*head).(tail) if result.success? Result::SUCCESS else Result.new(false, id) { [type, [options[:keys], result.to_ast]] } end end
type()
click to toggle source
# File lib/dry/logic/operations/check.rb, line 25 def type :check end