Class: YARD::Parser::Ruby::MethodCallNode
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
|
|
Instance Chain:
|
|
Inherits: |
YARD::Parser::Ruby::AstNode
|
Defined in: | lib/yard/parser/ruby/ast_node.rb |
Constant Summary
Managing node state
- #block
- #block_param
- #call? ⇒ Boolean readonly
- #call_has_paren? ⇒ Boolean readonly private
- #index_adjust private
- #method_name(name_only = false)
- #namespace
- #parameters(include_block_param = true)
Class Method Summary
AstNode
- Inherited
.new | Creates a new AST node. |
.node_class_for | Finds the node subclass that should be instantiated for a specific node type. |
Instance Attribute Summary
AstNode
- Inherited
#block?, #call?, | |
#comments | Alias for AstNode#docstring. |
#comments_hash_flag | Alias for AstNode#docstring_hash_flag. |
#comments_range | Alias for AstNode#docstring_range. |
#condition?, #def?, #docstring, #docstring_hash_flag, #docstring_range, #file, #file=, #full_source, #full_source=, #group, #has_line?, #kw?, #line_range, #line_range=, #literal?, #loop?, #parent, #ref?, #source, #source=, #source_range, #source_range=, | |
#to_s | Alias for AstNode#source. |
#token?, #type |
Instance Method Summary
AstNode
- Inherited
#==, #children, #first_line, #inspect, | |
#jump | Searches through the node and all descendants and returns the first node with a type matching any of |
#line, #pretty_print, #show, | |
#traverse | Traverses the object and yields each node (including descendants) in order. |
#unfreeze | Resets node state in tree. |
#reset_line_info | Resets line information. |
::Array
- Inherited
#place | Places values before or after another object (by value) in an array. |
Constructor Details
This class inherits a constructor from YARD::Parser::Ruby::AstNode
Instance Attribute Details
#call? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/yard/parser/ruby/ast_node.rb', line 439
def call?; true end
#call_has_paren? ⇒ Boolean
(readonly, private)
[ GitHub ]
# File 'lib/yard/parser/ruby/ast_node.rb', line 474
def call_has_paren? [:fcall, :call].include?(type) end
Instance Method Details
#block
[ GitHub ]# File 'lib/yard/parser/ruby/ast_node.rb', line 464
def block last.type == :do_block || last.type == :brace_block ? last : nil end
#block_param
[ GitHub ]# File 'lib/yard/parser/ruby/ast_node.rb', line 462
def block_param; parameters.last end
#index_adjust (private)
[ GitHub ]# File 'lib/yard/parser/ruby/ast_node.rb', line 470
def index_adjust [:call, :command_call].include?(type) ? 2 : 0 end
#method_name(name_only = false)
[ GitHub ]# 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
#namespace
[ GitHub ]# File 'lib/yard/parser/ruby/ast_node.rb', line 440
def namespace; first if index_adjust > 0 end
#parameters(include_block_param = true)
[ GitHub ]# 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