class Dry::Logic::Operations::And
Attributes
hints[R]
Public Class Methods
new(*, **)
click to toggle source
Calls superclass method
# File lib/dry/logic/operations/and.rb, line 9 def initialize(*, **) super @hints = options.fetch(:hints, true) end
Public Instance Methods
[](input)
click to toggle source
# File lib/dry/logic/operations/and.rb, line 38 def [](input) left[input] && right[input] end
call(input)
click to toggle source
# File lib/dry/logic/operations/and.rb, line 19 def call(input) left_result = left.(input) if left_result.success? right_result = right.(input) if right_result.success? Result::SUCCESS else Result.new(false, id) { right_result.ast(input) } end else Result.new(false, id) do left_ast = left_result.to_ast hints ? [type, [left_ast, [:hint, right.ast(input)]]] : left_ast end end end
type()
click to toggle source
# File lib/dry/logic/operations/and.rb, line 14 def type :and end
Also aliased as: operator