Sha256: ba522c9d759a8c3c5673989d8f01d17afd275a9e7ac768e31f42a429810c888a

Contents?: true

Size: 554 Bytes

Versions: 2

Compression:

Stored size: 554 Bytes

Contents

module Unparser
  class Emitter

    # Base class for while and until emitters
    class Repetition < self

      MAP = {
        :while => K_WHILE,
        :until => K_UNTIL
      }.freeze

      handle *MAP.keys

      children :condition, :body

    private

      # Perform dispatch
      #
      # @return [undefined]
      #
      # @api private
      #
      def dispatch
        write(MAP.fetch(node.type), WS)
        visit(condition)
        indented { visit(body) }
        k_end
      end

    end # Repetition
  end # Emitter
end # Unparser

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
unparser-0.0.2 lib/unparser/emitter/repetition.rb
unparser-0.0.1 lib/unparser/emitter/repetition.rb