Sha256: 2fe5e9d92fcf33d13aacd9f7abe7ab04da14a76fa73d87ac20ab3b06bef85dc0

Contents?: true

Size: 572 Bytes

Versions: 4

Compression:

Stored size: 572 Bytes

Contents

# frozen_string_literal: true

module Unparser
  class Emitter
    # Emitter control flow modifiers
    class FlowModifier < self
      MAP = {
        return: 'return',
        next:   'next',
        break:  'break'
      }.freeze

      private_constant(*constants(false))

      handle(*MAP.keys)

    private

      def dispatch
        write(MAP.fetch(node.type))

        unless children.empty?
          emit_arguments
        end
      end

      def emit_arguments
        ws
        delimited(children)
      end
    end # Return
  end # Emitter
end # Unparser

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
unparser-0.5.3 lib/unparser/emitter/flow_modifier.rb
unparser-0.5.2 lib/unparser/emitter/flow_modifier.rb
unparser-0.5.1 lib/unparser/emitter/flow_modifier.rb
unparser-0.5.0 lib/unparser/emitter/flow_modifier.rb