Class: SyntaxTree::WordsBeg
Overview
WordsBeg represents the beginning of a string literal array with interpolation.
%W[one two three]
In the snippet above, a WordsBeg would be created with the value of “%W[”. Note that these kinds of arrays can start with a lot of different delimiter types (e.g., %W| or %W<).
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
- String
-
the start of the word 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:) ⇒ WordsBeg
constructor
A new instance of WordsBeg.
Methods inherited from Node
#construct_keys, #end_char, #format, #pretty_print, #start_char, #to_json, #to_mermaid
Constructor Details
#initialize(value:, location:) ⇒ WordsBeg
Returns a new instance of WordsBeg.
12144 12145 12146 12147 |
# File 'lib/syntax_tree/node.rb', line 12144 def initialize(value:, location:) @value = value @location = location end |
Instance Attribute Details
#value ⇒ Object (readonly)
- String
-
the start of the word literal array
12142 12143 12144 |
# File 'lib/syntax_tree/node.rb', line 12142 def value @value end |
Instance Method Details
#===(other) ⇒ Object
12170 12171 12172 |
# File 'lib/syntax_tree/node.rb', line 12170 def ===(other) other.is_a?(WordsBeg) && value === other.value end |
#accept(visitor) ⇒ Object
12149 12150 12151 |
# File 'lib/syntax_tree/node.rb', line 12149 def accept(visitor) visitor.visit_words_beg(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
12153 12154 12155 |
# File 'lib/syntax_tree/node.rb', line 12153 def child_nodes [] end |
#copy(value: nil, location: nil) ⇒ Object
12157 12158 12159 12160 12161 12162 |
# File 'lib/syntax_tree/node.rb', line 12157 def copy(value: nil, location: nil) WordsBeg.new( value: value || self.value, location: location || self.location ) end |
#deconstruct_keys(_keys) ⇒ Object
12166 12167 12168 |
# File 'lib/syntax_tree/node.rb', line 12166 def deconstruct_keys(_keys) { value: value, location: location } end |