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.
10546
10547
10548
10549
|
# File 'lib/syntax_tree/node.rb', line 10546
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
10544
10545
10546
|
# File 'lib/syntax_tree/node.rb', line 10544
def value
@value
end
|
Instance Method Details
#===(other) ⇒ Object
10572
10573
10574
|
# File 'lib/syntax_tree/node.rb', line 10572
def ===(other)
other.is_a?(SymbolContent) && value === other.value
end
|
#accept(visitor) ⇒ Object
10551
10552
10553
|
# File 'lib/syntax_tree/node.rb', line 10551
def accept(visitor)
visitor.visit_symbol_content(self)
end
|
#child_nodes ⇒ Object
Also known as:
deconstruct
10555
10556
10557
|
# File 'lib/syntax_tree/node.rb', line 10555
def child_nodes
[]
end
|
#copy(value: nil, location: nil) ⇒ Object
10559
10560
10561
10562
10563
10564
|
# File 'lib/syntax_tree/node.rb', line 10559
def copy(value: nil, location: nil)
SymbolContent.new(
value: value || self.value,
location: location || self.location
)
end
|
#deconstruct_keys(_keys) ⇒ Object
10568
10569
10570
|
# File 'lib/syntax_tree/node.rb', line 10568
def deconstruct_keys(_keys)
{ value: value, location: location }
end
|