Sha256: 8974e5036c80d0e6f0529ade7a048c6456841a683ccfc276194d438c48c77e27

Contents?: true

Size: 964 Bytes

Versions: 1

Compression:

Stored size: 964 Bytes

Contents

# encoding: utf-8

module Unparser
  class Emitter
    class Send

      # Emitter for arguments of send nodes
      class Arguments < Emitter

      private

        # Perform dispatch
        #
        # @return [undefined]
        #
        # @api private
        #
        def dispatch
          return if children.empty?

          parentheses do
            delimited(effective_arguments)
          end
        end

        # Return effective arguments
        #
        # @return [Parser::AST::Node]
        #
        # @api private
        #
        def effective_arguments
          last = children.length - 1
          children.each_with_index.map do |argument, index|
            if last.equal?(index) && argument.type.equal?(:hash) && argument.children.any?
              argument.updated(:hash_body)
            else
              argument
            end
          end
        end

      end # Arguments
    end # Send
  end # Emitter
end # Unparser

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
unparser-0.1.15 lib/unparser/emitter/send/arguments.rb