Class: SyntaxTree::QWordsBeg
Overview
QWordsBeg represents the beginning of a string literal array.
%w[one two three]
In the snippet above, QWordsBeg represents the “%w[” token. 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 beginning of the array literal.
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:) ⇒ QWordsBeg
constructor
A new instance of QWordsBeg.
Methods inherited from Node
#construct_keys, #end_char, #format, #pretty_print, #start_char, #to_json, #to_mermaid
Constructor Details
#initialize(value:, location:) ⇒ QWordsBeg
Returns a new instance of QWordsBeg.
8845 8846 8847 8848 |
# File 'lib/syntax_tree/node.rb', line 8845 def initialize(value:, location:) @value = value @location = location end |
Instance Attribute Details
#value ⇒ Object (readonly)
- String
-
the beginning of the array literal
8843 8844 8845 |
# File 'lib/syntax_tree/node.rb', line 8843 def value @value end |
Instance Method Details
#===(other) ⇒ Object
8871 8872 8873 |
# File 'lib/syntax_tree/node.rb', line 8871 def ===(other) other.is_a?(QWordsBeg) && value === other.value end |
#accept(visitor) ⇒ Object
8850 8851 8852 |
# File 'lib/syntax_tree/node.rb', line 8850 def accept(visitor) visitor.visit_qwords_beg(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
8854 8855 8856 |
# File 'lib/syntax_tree/node.rb', line 8854 def child_nodes [] end |
#copy(value: nil, location: nil) ⇒ Object
8858 8859 8860 8861 8862 8863 |
# File 'lib/syntax_tree/node.rb', line 8858 def copy(value: nil, location: nil) QWordsBeg.new( value: value || self.value, location: location || self.location ) end |
#deconstruct_keys(_keys) ⇒ Object
8867 8868 8869 |
# File 'lib/syntax_tree/node.rb', line 8867 def deconstruct_keys(_keys) { value: value, location: location } end |