Class: SyntaxTree::SymbolContent
- Inherits:
-
Node
- Object
- Node
- SyntaxTree::SymbolContent
show all
- Defined in:
- lib/syntax_tree/node.rb
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
#location
Instance Method Summary
collapse
Methods inherited from Node
#construct_keys, #format, #pretty_print, #to_json
Constructor Details
#initialize(value:, location:) ⇒ SymbolContent
10391
10392
10393
10394
|
# File 'lib/syntax_tree/node.rb', line 10391
def initialize(value:, location:)
@value = value
@location = location
end
|
Instance Attribute Details
#value ⇒ Object
- Backtick | Const | CVar | GVar | Ident | IVar | Kw | Op
-
the value of the
symbol
10389
10390
10391
|
# File 'lib/syntax_tree/node.rb', line 10389
def value
@value
end
|
Instance Method Details
#===(other) ⇒ Object
10417
10418
10419
|
# File 'lib/syntax_tree/node.rb', line 10417
def ===(other)
other.is_a?(SymbolContent) && value === other.value
end
|
#accept(visitor) ⇒ Object
10396
10397
10398
|
# File 'lib/syntax_tree/node.rb', line 10396
def accept(visitor)
visitor.visit_symbol_content(self)
end
|
#child_nodes ⇒ Object
Also known as:
deconstruct
10400
10401
10402
|
# File 'lib/syntax_tree/node.rb', line 10400
def child_nodes
[]
end
|
#copy(value: nil, location: nil) ⇒ Object
10404
10405
10406
10407
10408
10409
|
# File 'lib/syntax_tree/node.rb', line 10404
def copy(value: nil, location: nil)
SymbolContent.new(
value: value || self.value,
location: location || self.location
)
end
|
#deconstruct_keys(_keys) ⇒ Object
10413
10414
10415
|
# File 'lib/syntax_tree/node.rb', line 10413
def deconstruct_keys(_keys)
{ value: value, location: location }
end
|