Class: SyntaxTree::MRHS
Overview
MRHS represents the values that are being assigned on the right-hand side of a multiple assignment.
values = first, second, third
Instance Attribute Summary collapse
-
#comments ⇒ Object
readonly
- Array[ Comment | EmbDoc ]
-
the comments attached to this node.
-
#parts ⇒ Object
readonly
Array the parts that are being assigned.
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: []) ⇒ MRHS
constructor
A new instance of MRHS.
Methods inherited from Node
#construct_keys, #pretty_print, #to_json
Constructor Details
#initialize(parts:, location:, comments: []) ⇒ MRHS
Returns a new instance of MRHS.
6516 6517 6518 6519 6520 |
# File 'lib/syntax_tree/node.rb', line 6516 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
6514 6515 6516 |
# File 'lib/syntax_tree/node.rb', line 6514 def comments @comments end |
#parts ⇒ Object (readonly)
Array the parts that are being assigned
6511 6512 6513 |
# File 'lib/syntax_tree/node.rb', line 6511 def parts @parts end |
Instance Method Details
#accept(visitor) ⇒ Object
6522 6523 6524 |
# File 'lib/syntax_tree/node.rb', line 6522 def accept(visitor) visitor.visit_mrhs(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
6526 6527 6528 |
# File 'lib/syntax_tree/node.rb', line 6526 def child_nodes parts end |
#deconstruct_keys(_keys) ⇒ Object
6532 6533 6534 |
# File 'lib/syntax_tree/node.rb', line 6532 def deconstruct_keys(_keys) { parts: parts, location: location, comments: comments } end |
#format(q) ⇒ Object
6536 6537 6538 |
# File 'lib/syntax_tree/node.rb', line 6536 def format(q) q.seplist(parts) { |part| q.format(part) } end |