Sha256: ee8bbbe84a79ccb64164ad2da46a043244ce00fafec52fa2d114f7d3d873376a

Contents?: true

Size: 541 Bytes

Versions: 2

Compression:

Stored size: 541 Bytes

Contents

# frozen_string_literal: true

require "dry/logic/operations/abstract"

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

2 entries across 2 versions & 1 rubygems

Version Path
dry-logic-1.2.0 lib/dry/logic/operations/binary.rb
dry-logic-1.1.1 lib/dry/logic/operations/binary.rb