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