Sha256: b634d76a69b97451943b861c04ff6e872416bfafeca9d97599d2926913941b6c

Contents?: true

Size: 703 Bytes

Versions: 15

Compression:

Stored size: 703 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)
        emit_block_arguments
        emit_body
        k_end
      end

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

    end # Block
  end # Emitter
end # Unparser

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
unparser-0.1.0 lib/unparser/emitter/block.rb
unparser-0.0.18 lib/unparser/emitter/block.rb
unparser-0.0.16 lib/unparser/emitter/block.rb
unparser-0.0.15 lib/unparser/emitter/block.rb
unparser-0.0.14 lib/unparser/emitter/block.rb
unparser-0.0.13 lib/unparser/emitter/block.rb
unparser-0.0.12 lib/unparser/emitter/block.rb
unparser-0.0.11 lib/unparser/emitter/block.rb
unparser-0.0.10 lib/unparser/emitter/block.rb
unparser-0.0.8 lib/unparser/emitter/block.rb
unparser-0.0.7 lib/unparser/emitter/block.rb
unparser-0.0.6 lib/unparser/emitter/block.rb
unparser-0.0.5 lib/unparser/emitter/block.rb
unparser-0.0.4 lib/unparser/emitter/block.rb
unparser-0.0.3 lib/unparser/emitter/block.rb