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.
653 654 655 656 657 |
# File 'lib/syntax_tree/node.rb', line 653 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
651 652 653 |
# File 'lib/syntax_tree/node.rb', line 651 def comments @comments end |
#parts ⇒ Object (readonly)
- Array[ untyped ]
-
the arguments that this node wraps
648 649 650 |
# File 'lib/syntax_tree/node.rb', line 648 def parts @parts end |
Instance Method Details
#accept(visitor) ⇒ Object
659 660 661 |
# File 'lib/syntax_tree/node.rb', line 659 def accept(visitor) visitor.visit_args(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
663 664 665 |
# File 'lib/syntax_tree/node.rb', line 663 def child_nodes parts end |
#deconstruct_keys(_keys) ⇒ Object
669 670 671 |
# File 'lib/syntax_tree/node.rb', line 669 def deconstruct_keys(_keys) { parts: parts, location: location, comments: comments } end |
#format(q) ⇒ Object
673 674 675 |
# File 'lib/syntax_tree/node.rb', line 673 def format(q) q.seplist(parts) { |part| q.format(part) } end |