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
7800 7801 7802 7803 7804 |
# File 'lib/syntax_tree/node.rb', line 7800 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
7798 7799 7800 |
# File 'lib/syntax_tree/node.rb', line 7798 def comments @comments end |
#value ⇒ Object (readonly)
- Backtick | Const | CVar | GVar | Ident | IVar | Kw | Op
-
the value of the
symbol
7795 7796 7797 |
# File 'lib/syntax_tree/node.rb', line 7795 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
7806 7807 7808 |
# File 'lib/syntax_tree/node.rb', line 7806 def accept(visitor) visitor.visit_symbol_literal(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
7810 7811 7812 |
# File 'lib/syntax_tree/node.rb', line 7810 def child_nodes [value] end |
#deconstruct_keys(keys) ⇒ Object
7816 7817 7818 |
# File 'lib/syntax_tree/node.rb', line 7816 def deconstruct_keys(keys) { value: value, location: location, comments: comments } end |
#format(q) ⇒ Object
7820 7821 7822 7823 |
# File 'lib/syntax_tree/node.rb', line 7820 def format(q) q.text(":") q.format(value) end |