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.
593 594 595 596 597 |
# File 'lib/syntax_tree/node.rb', line 593 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
591 592 593 |
# File 'lib/syntax_tree/node.rb', line 591 def comments @comments end |
#parts ⇒ Object (readonly)
- Array[ untyped ]
-
the arguments that this node wraps
588 589 590 |
# File 'lib/syntax_tree/node.rb', line 588 def parts @parts end |
Instance Method Details
#accept(visitor) ⇒ Object
599 600 601 |
# File 'lib/syntax_tree/node.rb', line 599 def accept(visitor) visitor.visit_args(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
603 604 605 |
# File 'lib/syntax_tree/node.rb', line 603 def child_nodes parts end |
#deconstruct_keys(keys) ⇒ Object
609 610 611 |
# File 'lib/syntax_tree/node.rb', line 609 def deconstruct_keys(keys) { parts: parts, location: location, comments: comments } end |
#format(q) ⇒ Object
613 614 615 |
# File 'lib/syntax_tree/node.rb', line 613 def format(q) q.seplist(parts) { |part| q.format(part) } end |