Class: SyntaxTree::LBracket
Overview
LBracket represents the use of a left bracket, i.e., [.
Instance Attribute Summary collapse
-
#comments ⇒ Object
readonly
- Array[ Comment | EmbDoc ]
-
the comments attached to this node.
-
#value ⇒ Object
readonly
- String
-
the left bracket.
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: []) ⇒ LBracket
constructor
A new instance of LBracket.
Methods inherited from Node
Constructor Details
#initialize(value:, location:, comments: []) ⇒ LBracket
Returns a new instance of LBracket.
5385 5386 5387 5388 5389 |
# File 'lib/syntax_tree/node.rb', line 5385 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
5383 5384 5385 |
# File 'lib/syntax_tree/node.rb', line 5383 def comments @comments end |
#value ⇒ Object (readonly)
- String
-
the left bracket
5380 5381 5382 |
# File 'lib/syntax_tree/node.rb', line 5380 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
5391 5392 5393 |
# File 'lib/syntax_tree/node.rb', line 5391 def accept(visitor) visitor.visit_lbracket(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
5395 5396 5397 |
# File 'lib/syntax_tree/node.rb', line 5395 def child_nodes [] end |
#deconstruct_keys(keys) ⇒ Object
5401 5402 5403 |
# File 'lib/syntax_tree/node.rb', line 5401 def deconstruct_keys(keys) { value: value, location: location, comments: comments } end |
#format(q) ⇒ Object
5405 5406 5407 |
# File 'lib/syntax_tree/node.rb', line 5405 def format(q) q.text(value) end |