Class: YARD::Parser::Ruby::MethodDefinitionNode
Managing node state
collapse
Instance Method Details
#def? ⇒ Boolean
474
|
# File 'lib/yard/parser/ruby/ast_node.rb', line 474
def def?; true end
|
#kw? ⇒ Boolean
473
|
# File 'lib/yard/parser/ruby/ast_node.rb', line 473
def kw?; true end
|
#method_name(name_only = false) ⇒ Object
477
478
479
480
|
# File 'lib/yard/parser/ruby/ast_node.rb', line 477
def method_name(name_only = false)
name = self[index_adjust]
name_only ? name.jump(:ident).first.to_sym : name
end
|
#namespace ⇒ Object
475
|
# File 'lib/yard/parser/ruby/ast_node.rb', line 475
def namespace; first if index_adjust > 0 end
|
#parameters(include_block_param = true) ⇒ Object
482
483
484
485
486
|
# File 'lib/yard/parser/ruby/ast_node.rb', line 482
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
488
489
490
491
492
493
494
495
496
497
|
# File 'lib/yard/parser/ruby/ast_node.rb', line 488
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
|