Class: SyntaxTree::SymbolLiteral
Overview
SymbolLiteral represents a symbol in the system with no interpolation (as opposed to a DynaSymbol which has interpolation).
:symbol
Instance Attribute Summary collapse
-
#comments ⇒ Object
readonly
- Array[ Comment | EmbDoc ]
-
the comments attached to this node.
-
#value ⇒ Object
readonly
- Backtick | Const | CVar | GVar | Ident | IVar | Kw | Op
-
the value of the symbol.
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: []) ⇒ SymbolLiteral
constructor
A new instance of SymbolLiteral.
Methods inherited from Node
Constructor Details
#initialize(value:, location:, comments: []) ⇒ SymbolLiteral
Returns a new instance of SymbolLiteral.
8343 8344 8345 8346 8347 |
# File 'lib/syntax_tree/node.rb', line 8343 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
8341 8342 8343 |
# File 'lib/syntax_tree/node.rb', line 8341 def comments @comments end |
#value ⇒ Object (readonly)
- Backtick | Const | CVar | GVar | Ident | IVar | Kw | Op
-
the value of the
symbol
8338 8339 8340 |
# File 'lib/syntax_tree/node.rb', line 8338 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
8349 8350 8351 |
# File 'lib/syntax_tree/node.rb', line 8349 def accept(visitor) visitor.visit_symbol_literal(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
8353 8354 8355 |
# File 'lib/syntax_tree/node.rb', line 8353 def child_nodes [value] end |
#deconstruct_keys(keys) ⇒ Object
8359 8360 8361 |
# File 'lib/syntax_tree/node.rb', line 8359 def deconstruct_keys(keys) { value: value, location: location, comments: comments } end |
#format(q) ⇒ Object
8363 8364 8365 8366 |
# File 'lib/syntax_tree/node.rb', line 8363 def format(q) q.text(":") q.format(value) end |