Sha256: 7cbb59ce6aada791706725a971a858f5fa9ab3b1d76817d3d9732b03b2ab918e
Contents?: true
Size: 720 Bytes
Versions: 6
Compression:
Stored size: 720 Bytes
Contents
# frozen_string_literal: true require "dry/logic/operations/binary" require "dry/logic/result" module Dry module Logic module Operations class Implication < Binary def type :implication end def operator :then end def call(input) left_result = left.(input) if left_result.success? right_result = right.(input) Result.new(right_result.success?, id) { right_result.to_ast } else Result::SUCCESS end end def [](input) if left[input] right[input] else true end end end end end end
Version data entries
6 entries across 6 versions & 2 rubygems