Sha256: 4b7dd7aa9cda121476ee7224cbdd7ff1379d9525eeba131c3c39ae69e4460ffa

Contents?: true

Size: 479 Bytes

Versions: 4

Compression:

Stored size: 479 Bytes

Contents

# frozen_string_literal: true

module Dry
  module Logic
    module Operations
      class Xor < Binary
        def type
          :xor
        end
        alias_method :operator, :type

        def call(input)
          Result.new(self[input], id) { ast(input) }
        end

        def [](input)
          left[input] ^ right[input]
        end

        def ast(input = Undefined)
          [type, rules.map { |rule| rule.ast(input) }]
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dry-logic-1.6.0 lib/dry/logic/operations/xor.rb
dry-logic-1.5.0 lib/dry/logic/operations/xor.rb
dry-logic-1.4.0 lib/dry/logic/operations/xor.rb
dry-logic-1.3.0 lib/dry/logic/operations/xor.rb