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
#construct_keys, #pretty_print, #to_json
Constructor Details
#initialize(parts:, location:, comments: []) ⇒ Args
Returns a new instance of Args.
638 639 640 641 642 |
# File 'lib/syntax_tree/node.rb', line 638 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
636 637 638 |
# File 'lib/syntax_tree/node.rb', line 636 def comments @comments end |
#parts ⇒ Object (readonly)
- Array[ untyped ]
-
the arguments that this node wraps
633 634 635 |
# File 'lib/syntax_tree/node.rb', line 633 def parts @parts end |
Instance Method Details
#accept(visitor) ⇒ Object
644 645 646 |
# File 'lib/syntax_tree/node.rb', line 644 def accept(visitor) visitor.visit_args(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
648 649 650 |
# File 'lib/syntax_tree/node.rb', line 648 def child_nodes parts end |
#deconstruct_keys(_keys) ⇒ Object
654 655 656 |
# File 'lib/syntax_tree/node.rb', line 654 def deconstruct_keys(_keys) { parts: parts, location: location, comments: comments } end |
#format(q) ⇒ Object
658 659 660 |
# File 'lib/syntax_tree/node.rb', line 658 def format(q) q.seplist(parts) { |part| q.format(part) } end |