Class: SyntaxTree::SymbolContent
Overview
SymbolContent represents symbol contents and is always the child of a SymbolLiteral node.
:symbol
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
- Backtick | Const | CVar | GVar | Ident | IVar | Kw | Op
-
the value of the symbol.
Attributes inherited from Node
Instance Method Summary collapse
- #===(other) ⇒ Object
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #copy(value: nil, location: nil) ⇒ Object
- #deconstruct_keys(_keys) ⇒ Object
-
#initialize(value:, location:) ⇒ SymbolContent
constructor
A new instance of SymbolContent.
Methods inherited from Node
#construct_keys, #format, #pretty_print, #to_json
Constructor Details
#initialize(value:, location:) ⇒ SymbolContent
Returns a new instance of SymbolContent.
10356 10357 10358 10359 |
# File 'lib/syntax_tree/node.rb', line 10356 def initialize(value:, location:) @value = value @location = location end |
Instance Attribute Details
#value ⇒ Object (readonly)
- Backtick | Const | CVar | GVar | Ident | IVar | Kw | Op
-
the value of the
symbol
10354 10355 10356 |
# File 'lib/syntax_tree/node.rb', line 10354 def value @value end |
Instance Method Details
#===(other) ⇒ Object
10382 10383 10384 |
# File 'lib/syntax_tree/node.rb', line 10382 def ===(other) other.is_a?(SymbolContent) && value === other.value end |
#accept(visitor) ⇒ Object
10361 10362 10363 |
# File 'lib/syntax_tree/node.rb', line 10361 def accept(visitor) visitor.visit_symbol_content(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
10365 10366 10367 |
# File 'lib/syntax_tree/node.rb', line 10365 def child_nodes [] end |
#copy(value: nil, location: nil) ⇒ Object
10369 10370 10371 10372 10373 10374 |
# File 'lib/syntax_tree/node.rb', line 10369 def copy(value: nil, location: nil) SymbolContent.new( value: value || self.value, location: location || self.location ) end |
#deconstruct_keys(_keys) ⇒ Object
10378 10379 10380 |
# File 'lib/syntax_tree/node.rb', line 10378 def deconstruct_keys(_keys) { value: value, location: location } end |