Sha256: beb809d78bf61ae8e3009eff5e77295835c1b1ab18334607cba013937b90605d
Contents?: true
Size: 545 Bytes
Versions: 5
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
5 entries across 5 versions & 1 rubygems