Sha256: ef69b2a57366161bee3ec02e4d4e466b01096fce9509395bc5ff948453764f72

Contents?: true

Size: 753 Bytes

Versions: 2

Compression:

Stored size: 753 Bytes

Contents

# encoding: utf-8

module Unparser
  class Emitter
    # Emitter for return nodes
    class Return < self

      handle :return

    private

      # Perform dispatch
      #
      # @return [undefined]
      #
      # @api private
      #
      def dispatch
        write(K_RETURN)
        emit_break_return_arguments
      end

      # Emit break or return arguments
      #
      # @return [undefined]
      #
      # @api private
      #
      def emit_break_return_arguments
        return if children.empty?
        head, *tail = children
        parentheses { visit(head) }
        tail.each do |node|
          write(DEFAULT_DELIMITER)
          parentheses { visit(node) }
        end
      end

    end # Return
  end # Emitter
end # Unparser

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
unparser-0.1.7 lib/unparser/emitter/return.rb
unparser-0.1.6 lib/unparser/emitter/return.rb