Sha256: e1a4794bbc8f537063c0310582149cf892e24523751d9ae1ff82c8dcd6709b8b
Contents?: true
Size: 545 Bytes
Versions: 6
Compression:
Stored size: 545 Bytes
Contents
# frozen_string_literal: true require "dry/logic/operations/binary" require "dry/logic/result" 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
6 entries across 6 versions & 2 rubygems