Sha256: 70c2484f66d1478253fc8ffe4f316dab96cae2d6ef8a6d46e3a101b906749e8f

Contents?: true

Size: 670 Bytes

Versions: 2

Compression:

Stored size: 670 Bytes

Contents

module Unparser
  class Emitter
    # Base class for binary emitters
    class Binary < self

      children :left, :right

      MAP = {
        or:  T_OR,
        and: T_AND
      }.freeze

      handle(*MAP.keys)

      # Test if expression is terminated
      #
      # @return [false]
      #
      # @api private
      #
      def terminated?
        false
      end

    private

      # Perform dispatch
      #
      # @return [undefined]
      #
      # @api private
      #
      def dispatch
        visit_terminated(left)
        write(WS, MAP.fetch(node.type), WS)
        visit_terminated(right)
      end

    end # Binary
  end # Emitter
end # Unparser

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
unparser-0.1.5 lib/unparser/emitter/binary.rb
unparser-0.1.4 lib/unparser/emitter/binary.rb