Class: YARD::Parser::Ruby::MethodDefinitionNode

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

Constant Summary

Instance Attribute Summary collapse

Managing node state collapse

Constructor Details

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

Instance Attribute Details

#docstring ⇒ Object Also known as: comments Originally defined in class AstNode

Returns the value of attribute docstring

#docstring_hash_flag ⇒ Object Also known as: comments_hash_flag Originally defined in class AstNode

Returns the value of attribute docstring_hash_flag

#docstring_range ⇒ Object Also known as: comments_range Originally defined in class AstNode

Returns the value of attribute docstring_range

#file ⇒ String Originally defined in class AstNode

Returns the filename the node was parsed from

Returns:

  • (String) —

    the filename the node was parsed from

#full_source ⇒ String Originally defined in class AstNode

Returns the full source that the node was parsed from

Returns:

  • (String) —

    the full source that the node was parsed from

#group ⇒ Object Originally defined in class AstNode

Deprecated.

Groups are now defined by directives

#line_range ⇒ Range Originally defined in class AstNode

Returns the line range in #full_source represented by the node

Returns:

  • (Range) —

    the line range in #full_source represented by the node

#parent ⇒ AstNode? Originally defined in class AstNode

Returns the node's parent or nil if it is a root node.

Returns:

  • (AstNode, nil) —

    the node's parent or nil if it is a root node.

#source ⇒ String Originally defined in class AstNode

Returns the parse of #full_source that the node represents

Returns:

#source_range ⇒ Range Originally defined in class AstNode

Returns the character range in #full_source represented by the node

Returns:

  • (Range) —

    the character range in #full_source represented by the node

#type ⇒ Symbol Originally defined in class AstNode

Returns the node's unique symbolic type

Returns:

  • (Symbol) —

    the node's unique symbolic type

Instance Method Details

#def? ⇒ Boolean

Returns:

  • (Boolean)


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

def def?; true end

#kw? ⇒ Boolean

Returns:

  • (Boolean)


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

def kw?; true end

#method_name(name_only = false) ⇒ Object



466
467
468
469
# File 'lib/yard/parser/ruby/ast_node.rb', line 466

def method_name(name_only = false)
  name = self[index_adjust]
  name_only ? name.jump(:ident).first.to_sym : name
end

#namespace ⇒ Object



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

def namespace; first if index_adjust > 0 end

#parameters(include_block_param = true) ⇒ Object



471
472
473
474
475
# File 'lib/yard/parser/ruby/ast_node.rb', line 471

def parameters(include_block_param = true)
  params = self[1 + index_adjust]
  params = params[0] if params.type == :paren
  include_block_param ? params : params[0...-1]
end