Class: SyntaxTree::ArgStar
Overview
Star represents using a splat operator on an expression.
method(*arguments)
Instance Attribute Summary collapse
-
#comments ⇒ Object
readonly
- Array[ Comment | EmbDoc ]
-
the comments attached to this node.
-
#value ⇒ Object
readonly
- nil | untyped
-
the expression being splatted.
Attributes inherited from Node
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #deconstruct_keys(keys) ⇒ Object
- #format(q) ⇒ Object
-
#initialize(value:, location:, comments: []) ⇒ ArgStar
constructor
A new instance of ArgStar.
Methods inherited from Node
Constructor Details
#initialize(value:, location:, comments: []) ⇒ ArgStar
Returns a new instance of ArgStar.
651 652 653 654 655 |
# File 'lib/syntax_tree/node.rb', line 651 def initialize(value:, location:, comments: []) @value = value @location = location @comments = comments end |
Instance Attribute Details
#comments ⇒ Object (readonly)
- Array[ Comment | EmbDoc ]
-
the comments attached to this node
649 650 651 |
# File 'lib/syntax_tree/node.rb', line 649 def comments @comments end |
#value ⇒ Object (readonly)
- nil | untyped
-
the expression being splatted
646 647 648 |
# File 'lib/syntax_tree/node.rb', line 646 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
657 658 659 |
# File 'lib/syntax_tree/node.rb', line 657 def accept(visitor) visitor.visit_arg_star(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
661 662 663 |
# File 'lib/syntax_tree/node.rb', line 661 def child_nodes [value] end |
#deconstruct_keys(keys) ⇒ Object
667 668 669 |
# File 'lib/syntax_tree/node.rb', line 667 def deconstruct_keys(keys) { value: value, location: location, comments: comments } end |
#format(q) ⇒ Object
671 672 673 674 |
# File 'lib/syntax_tree/node.rb', line 671 def format(q) q.text("*") q.format(value) if value end |