Sha256: 674cee35f57bfea7db179ffbec4063a2e53334ca262351d515dcbff51a49c30b

Contents?: true

Size: 489 Bytes

Versions: 7

Compression:

Stored size: 489 Bytes

Contents

require 'dry/logic/operations/abstract'

module Dry
  module Logic
    module Operations
      class Binary < Abstract
        attr_reader :left

        attr_reader :right

        def initialize(*rules, **options)
          super
          @left, @right = rules
        end

        def ast(input = Undefined)
          [type, [left.ast(input), right.ast(input)]]
        end

        def to_s
          "#{left} #{operator.to_s.upcase} #{right}"
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
dry-logic-1.0.0 lib/dry/logic/operations/binary.rb
dry-logic-0.6.1 lib/dry/logic/operations/binary.rb
dry-logic-0.6.0 lib/dry/logic/operations/binary.rb
dry-logic-0.5.0 lib/dry/logic/operations/binary.rb
dry-logic-0.4.2 lib/dry/logic/operations/binary.rb
dry-logic-0.4.1 lib/dry/logic/operations/binary.rb
dry-logic-0.4.0 lib/dry/logic/operations/binary.rb