Sha256: e24ebf70040ae4a20032cc2f15bcee1cc640b41cecd4c65700e514ce08676dcc

Contents?: true

Size: 689 Bytes

Versions: 10

Compression:

Stored size: 689 Bytes

Contents

# encoding: utf-8

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

10 entries across 10 versions & 1 rubygems

Version Path
unparser-0.1.15 lib/unparser/emitter/binary.rb
unparser-0.1.14 lib/unparser/emitter/binary.rb
unparser-0.1.13 lib/unparser/emitter/binary.rb
unparser-0.1.12 lib/unparser/emitter/binary.rb
unparser-0.1.11 lib/unparser/emitter/binary.rb
unparser-0.1.10 lib/unparser/emitter/binary.rb
unparser-0.1.9 lib/unparser/emitter/binary.rb
unparser-0.1.8 lib/unparser/emitter/binary.rb
unparser-0.1.7 lib/unparser/emitter/binary.rb
unparser-0.1.6 lib/unparser/emitter/binary.rb