Class: SyntaxTree::QWordsBeg
- Inherits:
-
Node
- Object
- Node
- SyntaxTree::QWordsBeg
show all
- Defined in:
- lib/syntax_tree/node.rb
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
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:) ⇒ QWordsBeg
8723
8724
8725
8726
|
# File 'lib/syntax_tree/node.rb', line 8723
def initialize(value:, location:)
@value = value
@location = location
end
|
Instance Attribute Details
#value ⇒ Object
- String
-
the beginning of the array literal
8721
8722
8723
|
# File 'lib/syntax_tree/node.rb', line 8721
def value
@value
end
|
Instance Method Details
#===(other) ⇒ Object
8749
8750
8751
|
# File 'lib/syntax_tree/node.rb', line 8749
def ===(other)
other.is_a?(QWordsBeg) && value === other.value
end
|
#accept(visitor) ⇒ Object
8728
8729
8730
|
# File 'lib/syntax_tree/node.rb', line 8728
def accept(visitor)
visitor.visit_qwords_beg(self)
end
|
#child_nodes ⇒ Object
Also known as:
deconstruct
8732
8733
8734
|
# File 'lib/syntax_tree/node.rb', line 8732
def child_nodes
[]
end
|
#copy(value: nil, location: nil) ⇒ Object
8736
8737
8738
8739
8740
8741
|
# File 'lib/syntax_tree/node.rb', line 8736
def copy(value: nil, location: nil)
QWordsBeg.new(
value: value || self.value,
location: location || self.location
)
end
|
#deconstruct_keys(_keys) ⇒ Object
8745
8746
8747
|
# File 'lib/syntax_tree/node.rb', line 8745
def deconstruct_keys(_keys)
{ value: value, location: location }
end
|