Class: SyntaxTree::SymbolContent

Inherits:
Node
  • Object
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

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

Returns a new instance of SymbolContent.



8577
8578
8579
8580
# File 'lib/syntax_tree/node.rb', line 8577

def initialize(value:, location:)
  @value = value
  @location = location
end

Instance Attribute Details

#valueObject (readonly)

Backtick | Const | CVar | GVar | Ident | IVar | Kw | Op

the value of the

symbol



8575
8576
8577
# File 'lib/syntax_tree/node.rb', line 8575

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



8582
8583
8584
# File 'lib/syntax_tree/node.rb', line 8582

def accept(visitor)
  visitor.visit_symbol_content(self)
end

#child_nodesObject Also known as: deconstruct



8586
8587
8588
# File 'lib/syntax_tree/node.rb', line 8586

def child_nodes
  []
end

#deconstruct_keys(_keys) ⇒ Object



8592
8593
8594
# File 'lib/syntax_tree/node.rb', line 8592

def deconstruct_keys(_keys)
  { value: value, location: location }
end