Class: YARD::Parser::Ruby::MethodDefinitionNode
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?, #call?, #children, #condition?, #first_line, #has_line?, #initialize, #inspect, #jump, #line, #literal?, #loop?, node_class_for, #pretty_print, #ref?, #show, #to_s, #token?, #traverse, #unfreeze
Methods inherited from Array
#place
Instance Method Details
#def? ⇒ Boolean
481
|
# File 'lib/yard/parser/ruby/ast_node.rb', line 481
def def?; true end
|
#kw? ⇒ Boolean
480
|
# File 'lib/yard/parser/ruby/ast_node.rb', line 480
def kw?; true end
|
#method_name(name_only = false) ⇒ Object
484
485
486
487
|
# File 'lib/yard/parser/ruby/ast_node.rb', line 484
def method_name(name_only = false)
name = self[index_adjust]
name_only ? name.jump(:ident).first.to_sym : name
end
|
#namespace ⇒ Object
482
|
# File 'lib/yard/parser/ruby/ast_node.rb', line 482
def namespace; first if index_adjust > 0 end
|
#parameters(include_block_param = true) ⇒ Object
489
490
491
492
493
|
# File 'lib/yard/parser/ruby/ast_node.rb', line 489
def parameters(include_block_param = true)
return unless params = self[1 + index_adjust]
params = params[0] if params.type == :paren
include_block_param ? params : params[0...-1]
end
|
#signature ⇒ Object
495
496
497
498
499
500
501
502
503
504
|
# File 'lib/yard/parser/ruby/ast_node.rb', line 495
def signature
params_src = ''
params = self[1 + index_adjust]
if params and params.first
params_src = params.type == :paren ? '' : ' '
params_src += params.source.gsub(/\s+(\s|\))/m, '\1')
end
"def #{method_name(true)}#{params_src}"
end
|