Class: YARD::Parser::Ruby::MethodCallNode

Inherits:
AstNode show all
Defined in:
lib/yard/parser/ruby/ast_node.rb

Constant Summary

Constants inherited from AstNode

AstNode::KEYWORDS

Instance Attribute Summary

Attributes inherited from AstNode

#docstring, #docstring_hash_flag, #docstring_range, #file, #full_source, #group, #line_range, #parent, #source, #source_range, #type

Managing node state collapse

Methods inherited from AstNode

#==, #block?, #children, #condition?, #def?, #first_line, #has_line?, #initialize, #inspect, #jump, #kw?, #line, #literal?, #loop?, node_class_for, #pretty_print, #ref?, #show, #to_s, #token?, #traverse, #unfreeze

Methods inherited from Array

#place

Constructor Details

This class inherits a constructor from YARD::Parser::Ruby::AstNode

Instance Method Details

#blockObject



464
465
466
# File 'lib/yard/parser/ruby/ast_node.rb', line 464

def block
  last.type == :do_block || last.type == :brace_block ? last : nil
end

#block_paramObject



462
# File 'lib/yard/parser/ruby/ast_node.rb', line 462

def block_param; parameters.last end

#call?Boolean

Returns:

  • (Boolean)


439
# File 'lib/yard/parser/ruby/ast_node.rb', line 439

def call?; true end

#method_name(name_only = false) ⇒ Object



442
443
444
445
446
447
448
449
450
451
# File 'lib/yard/parser/ruby/ast_node.rb', line 442

def method_name(name_only = false)
  name = self[index_adjust]
  if name == :call
    nil
  elsif name_only && Array === name
    name.jump(:ident).first.to_sym
  else
    name
  end
end

#namespaceObject



440
# File 'lib/yard/parser/ruby/ast_node.rb', line 440

def namespace; first if index_adjust > 0 end

#parameters(include_block_param = true) ⇒ Object



453
454
455
456
457
458
459
460
# File 'lib/yard/parser/ruby/ast_node.rb', line 453

def parameters(include_block_param = true)
  return [] if type == :vcall
  params = self[1 + index_adjust]
  return [] unless params
  params = call_has_paren? ? params.first : params
  return [] unless params
  include_block_param ? params : params[0...-1]
end