Class: YARD::Parser::Ruby::ParameterNode
- Defined in:
- lib/yard/parser/ruby/ast_node.rb
Constant Summary
Instance Attribute Summary collapse
-
#docstring ⇒ Object
(also: #comments)
inherited
from AstNode
Returns the value of attribute docstring.
-
#docstring_hash_flag ⇒ Object
(also: #comments_hash_flag)
inherited
from AstNode
Returns the value of attribute docstring_hash_flag.
-
#docstring_range ⇒ Object
(also: #comments_range)
inherited
from AstNode
Returns the value of attribute docstring_range.
-
#file ⇒ String
inherited
from AstNode
The filename the node was parsed from.
-
#full_source ⇒ String
inherited
from AstNode
The full source that the node was parsed from.
-
#group ⇒ Object
inherited
from AstNode
deprecated
Deprecated.
Groups are now defined by directives
-
#line_range ⇒ Range
inherited
from AstNode
The line range in AstNode#full_source represented by the node.
-
#parent ⇒ AstNode?
inherited
from AstNode
The node's parent or nil if it is a root node.
-
#source ⇒ String
inherited
from AstNode
The parse of AstNode#full_source that the node represents.
-
#source_range ⇒ Range
inherited
from AstNode
The character range in AstNode#full_source represented by the node.
-
#type ⇒ Symbol
inherited
from AstNode
The node's unique symbolic type.
Managing node state collapse
- #block_param ⇒ Object
- #double_splat_param ⇒ Object
- #named_params ⇒ Object
- #splat_param ⇒ Object
- #unnamed_end_params ⇒ Object
- #unnamed_optional_params ⇒ Object
- #unnamed_required_params ⇒ Object
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
#full_source ⇒ String Originally defined in class AstNode
Returns the full source that the node was parsed from
#group ⇒ Object Originally defined in class AstNode
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
#parent ⇒ AstNode? Originally defined in class AstNode
Returns 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
#source_range ⇒ Range Originally defined in class AstNode
Returns the character range in #full_source represented by the node
#type ⇒ Symbol Originally defined in class AstNode
Returns the node's unique symbolic type
Instance Method Details
#block_param ⇒ Object
416 417 418 |
# File 'lib/yard/parser/ruby/ast_node.rb', line 416 def block_param self[-1] ? self[-1][0] : nil end |
#double_splat_param ⇒ Object
412 413 414 |
# File 'lib/yard/parser/ruby/ast_node.rb', line 412 def double_splat_param YARD.ruby2? ? self[-2] : nil end |
#named_params ⇒ Object
394 395 396 397 398 399 400 401 402 |
# File 'lib/yard/parser/ruby/ast_node.rb', line 394 def named_params return @named_params if defined?(@named_params) if YARD.ruby2? && self[-3] && self[-3][0] && self[-3][0].type == :named_arg @named_params = self[-3] else @named_params = nil end end |
#splat_param ⇒ Object
404 405 406 |
# File 'lib/yard/parser/ruby/ast_node.rb', line 404 def splat_param self[2] ? self[2][0] : nil end |
#unnamed_end_params ⇒ Object
408 409 410 |
# File 'lib/yard/parser/ruby/ast_node.rb', line 408 def unnamed_end_params self[3] end |
#unnamed_optional_params ⇒ Object
383 384 385 386 387 388 389 390 391 392 |
# File 'lib/yard/parser/ruby/ast_node.rb', line 383 def unnamed_optional_params return @unnamed_optional_params if defined?(@unnamed_optional_params) params = self[1] || [] if self[-3] && self[-3][0] && self[-3][0].type == :unnamed_optional_arg params += self[-3] end @unnamed_optional_params = params.empty? ? nil : params end |
#unnamed_required_params ⇒ Object
379 380 381 |
# File 'lib/yard/parser/ruby/ast_node.rb', line 379 def unnamed_required_params self[0] end |