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.
5909 5910 5911 5912 5913 |
# File 'lib/syntax_tree/node.rb', line 5909 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
5907 5908 5909 |
# File 'lib/syntax_tree/node.rb', line 5907 def comments @comments end |
#value ⇒ Object (readonly)
- String
-
the left bracket
5904 5905 5906 |
# File 'lib/syntax_tree/node.rb', line 5904 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
5915 5916 5917 |
# File 'lib/syntax_tree/node.rb', line 5915 def accept(visitor) visitor.visit_lbracket(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
5919 5920 5921 |
# File 'lib/syntax_tree/node.rb', line 5919 def child_nodes [] end |
#deconstruct_keys(keys) ⇒ Object
5925 5926 5927 |
# File 'lib/syntax_tree/node.rb', line 5925 def deconstruct_keys(keys) { value: value, location: location, comments: comments } end |
#format(q) ⇒ Object
5929 5930 5931 |
# File 'lib/syntax_tree/node.rb', line 5929 def format(q) q.text(value) end |