Sha256: d5daaff31dbd9be92d7bd51a9dd29fe40ff9e05d83baedd4547c98231cf0e6d0

Contents?: true

Size: 717 Bytes

Versions: 3

Compression:

Stored size: 717 Bytes

Contents

module Unparser
  class Emitter

    # Block emitter
    class Block < self

      handle :block

      children :send, :arguments, :body

    private

      # Perform dispatch
      #
      # @return [undefined]
      #
      # @api private
      #
      def dispatch
        visit(send)
        write(WS, K_DO)
        comments.consume(node, :begin)
        emit_block_arguments
        emit_body
        k_end
      end

      # Emit arguments
      #
      # @return [undefined]
      #
      # @api private
      #
      def emit_block_arguments
        return if arguments.children.empty?
        ws
        visit_parentheses(arguments, T_PIPE, T_PIPE)
      end

    end # Block
  end # Emitter
end # Unparser

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
unparser-0.1.5 lib/unparser/emitter/block.rb
unparser-0.1.4 lib/unparser/emitter/block.rb
unparser-0.1.3 lib/unparser/emitter/block.rb