Class: SyntaxTree::Args
Overview
Args represents a list of arguments being passed to a method call or array literal.
method(first, second, third)
Instance Attribute Summary collapse
-
#comments ⇒ Object
readonly
- Array[ Comment | EmbDoc ]
-
the comments attached to this node.
-
#parts ⇒ Object
readonly
- Array[ untyped ]
-
the arguments that this node wraps.
Attributes inherited from Node
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #deconstruct_keys(keys) ⇒ Object
- #format(q) ⇒ Object
-
#initialize(parts:, location:, comments: []) ⇒ Args
constructor
A new instance of Args.
Methods inherited from Node
Constructor Details
#initialize(parts:, location:, comments: []) ⇒ Args
Returns a new instance of Args.
578 579 580 581 582 |
# File 'lib/syntax_tree/node.rb', line 578 def initialize(parts:, location:, comments: []) @parts = parts @location = location @comments = comments end |
Instance Attribute Details
#comments ⇒ Object (readonly)
- Array[ Comment | EmbDoc ]
-
the comments attached to this node
576 577 578 |
# File 'lib/syntax_tree/node.rb', line 576 def comments @comments end |
#parts ⇒ Object (readonly)
- Array[ untyped ]
-
the arguments that this node wraps
573 574 575 |
# File 'lib/syntax_tree/node.rb', line 573 def parts @parts end |
Instance Method Details
#accept(visitor) ⇒ Object
584 585 586 |
# File 'lib/syntax_tree/node.rb', line 584 def accept(visitor) visitor.visit_args(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
588 589 590 |
# File 'lib/syntax_tree/node.rb', line 588 def child_nodes parts end |
#deconstruct_keys(keys) ⇒ Object
594 595 596 |
# File 'lib/syntax_tree/node.rb', line 594 def deconstruct_keys(keys) { parts: parts, location: location, comments: comments } end |
#format(q) ⇒ Object
598 599 600 |
# File 'lib/syntax_tree/node.rb', line 598 def format(q) q.seplist(parts) { |part| q.format(part) } end |