Sha256: 34ed6d6f1c7dbe8ae6dad00453f5da5441aeddda3442ca1dd9ba81fa7e46ada1

Contents?: true

Size: 500 Bytes

Versions: 4

Compression:

Stored size: 500 Bytes

Contents

# frozen_string_literal: true

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

        attr_reader :right

        def initialize(left, right, **options)
          super
          @left = left
          @right = right
        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

4 entries across 4 versions & 1 rubygems

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