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
#construct_keys, #pretty_print, #to_json
Constructor Details
#initialize(value:, location:, comments: []) ⇒ ArgStar
726 727 728 729 730 |
# File 'lib/syntax_tree/node.rb', line 726 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
724 725 726 |
# File 'lib/syntax_tree/node.rb', line 724 def comments @comments end |
#value ⇒ Object (readonly)
- nil | untyped
-
the expression being splatted
721 722 723 |
# File 'lib/syntax_tree/node.rb', line 721 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
732 733 734 |
# File 'lib/syntax_tree/node.rb', line 732 def accept(visitor) visitor.visit_arg_star(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
736 737 738 |
# File 'lib/syntax_tree/node.rb', line 736 def child_nodes [value] end |
#deconstruct_keys(_keys) ⇒ Object
742 743 744 |
# File 'lib/syntax_tree/node.rb', line 742 def deconstruct_keys(_keys) { value: value, location: location, comments: comments } end |
#format(q) ⇒ Object
746 747 748 749 |
# File 'lib/syntax_tree/node.rb', line 746 def format(q) q.text("*") q.format(value) if value end |