Class: SyntaxTree::SymbolsBeg
Overview
SymbolsBeg represents the start of a symbol array literal with interpolation.
%I[one two three]
In the snippet above, SymbolsBeg represents the “%I[” token. Note that these kinds of arrays can start with a lot of different delimiter types (e.g., %I| or %I<).
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
- String
-
the beginning of the symbol literal array.
Attributes inherited from Node
Instance Method Summary collapse
- #===(other) ⇒ Object
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #copy(value: nil, location: nil) ⇒ Object
- #deconstruct_keys(_keys) ⇒ Object
-
#initialize(value:, location:) ⇒ SymbolsBeg
constructor
A new instance of SymbolsBeg.
Methods inherited from Node
#construct_keys, #end_char, #format, #pretty_print, #start_char, #to_json, #to_mermaid
Constructor Details
#initialize(value:, location:) ⇒ SymbolsBeg
Returns a new instance of SymbolsBeg.
10657 10658 10659 10660 |
# File 'lib/syntax_tree/node.rb', line 10657 def initialize(value:, location:) @value = value @location = location end |
Instance Attribute Details
#value ⇒ Object (readonly)
- String
-
the beginning of the symbol literal array
10655 10656 10657 |
# File 'lib/syntax_tree/node.rb', line 10655 def value @value end |
Instance Method Details
#===(other) ⇒ Object
10683 10684 10685 |
# File 'lib/syntax_tree/node.rb', line 10683 def ===(other) other.is_a?(SymbolsBeg) && value === other.value end |
#accept(visitor) ⇒ Object
10662 10663 10664 |
# File 'lib/syntax_tree/node.rb', line 10662 def accept(visitor) visitor.visit_symbols_beg(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
10666 10667 10668 |
# File 'lib/syntax_tree/node.rb', line 10666 def child_nodes [] end |
#copy(value: nil, location: nil) ⇒ Object
10670 10671 10672 10673 10674 10675 |
# File 'lib/syntax_tree/node.rb', line 10670 def copy(value: nil, location: nil) SymbolsBeg.new( value: value || self.value, location: location || self.location ) end |
#deconstruct_keys(_keys) ⇒ Object
10679 10680 10681 |
# File 'lib/syntax_tree/node.rb', line 10679 def deconstruct_keys(_keys) { value: value, location: location } end |