Class: SyntaxTree::SymBeg
Overview
SymBeg represents the beginning of a symbol literal.
:symbol
SymBeg is also used for dynamic symbols, as in:
:"symbol"
Finally, SymBeg is also used for symbols using the %s syntax, as in:
s[symbol]
The value of this node is a string. In most cases (as in the first example above) it will contain just “:”. In the case of dynamic symbols it will contain “:‘” or “:"”. In the case of %s symbols, it will contain the start of the symbol including the %s and the delimiter.
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
- String
-
the beginning of the symbol.
Attributes inherited from Node
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(value:, location:) ⇒ SymBeg
constructor
A new instance of SymBeg.
Methods inherited from Node
#format, #pretty_print, #to_json
Constructor Details
#initialize(value:, location:) ⇒ SymBeg
Returns a new instance of SymBeg.
7737 7738 7739 7740 |
# File 'lib/syntax_tree/node.rb', line 7737 def initialize(value:, location:) @value = value @location = location end |
Instance Attribute Details
#value ⇒ Object (readonly)
- String
-
the beginning of the symbol
7735 7736 7737 |
# File 'lib/syntax_tree/node.rb', line 7735 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
7742 7743 7744 |
# File 'lib/syntax_tree/node.rb', line 7742 def accept(visitor) visitor.visit_symbeg(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
7746 7747 7748 |
# File 'lib/syntax_tree/node.rb', line 7746 def child_nodes [] end |
#deconstruct_keys(keys) ⇒ Object
7752 7753 7754 |
# File 'lib/syntax_tree/node.rb', line 7752 def deconstruct_keys(keys) { value: value, location: location } end |