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, #end_char, #format, #pretty_print, #start_char, #to_json, #to_mermaid
Constructor Details
#initialize(value:, location:) ⇒ SymbolContent
Returns a new instance of SymbolContent.
10531
10532
10533
10534
|
# File 'lib/syntax_tree/node.rb', line 10531
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
10529
10530
10531
|
# File 'lib/syntax_tree/node.rb', line 10529
def value
@value
end
|
Instance Method Details
#===(other) ⇒ Object
10557
10558
10559
|
# File 'lib/syntax_tree/node.rb', line 10557
def ===(other)
other.is_a?(SymbolContent) && value === other.value
end
|
#accept(visitor) ⇒ Object
10536
10537
10538
|
# File 'lib/syntax_tree/node.rb', line 10536
def accept(visitor)
visitor.visit_symbol_content(self)
end
|
#child_nodes ⇒ Object
Also known as:
deconstruct
10540
10541
10542
|
# File 'lib/syntax_tree/node.rb', line 10540
def child_nodes
[]
end
|
#copy(value: nil, location: nil) ⇒ Object
10544
10545
10546
10547
10548
10549
|
# File 'lib/syntax_tree/node.rb', line 10544
def copy(value: nil, location: nil)
SymbolContent.new(
value: value || self.value,
location: location || self.location
)
end
|
#deconstruct_keys(_keys) ⇒ Object
10553
10554
10555
|
# File 'lib/syntax_tree/node.rb', line 10553
def deconstruct_keys(_keys)
{ value: value, location: location }
end
|