Class: SyntaxTree::TStringEnd
- Inherits:
-
Node
- Object
- Node
- SyntaxTree::TStringEnd
show all
- Defined in:
- lib/syntax_tree/node.rb
Overview
TStringEnd represents the end of a string literal.
"string"
In the example above, TStringEnd represents the second set of quotes. Strings can also use single quotes. They can also be declared using the %q and %Q syntax, as in:
%q{string}
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:) ⇒ TStringEnd
10875
10876
10877
10878
|
# File 'lib/syntax_tree/node.rb', line 10875
def initialize(value:, location:)
@value = value
@location = location
end
|
Instance Attribute Details
#value ⇒ Object
- String
-
the end of the string
10873
10874
10875
|
# File 'lib/syntax_tree/node.rb', line 10873
def value
@value
end
|
Instance Method Details
#===(other) ⇒ Object
10901
10902
10903
|
# File 'lib/syntax_tree/node.rb', line 10901
def ===(other)
other.is_a?(TStringEnd) && value === other.value
end
|
#accept(visitor) ⇒ Object
10880
10881
10882
|
# File 'lib/syntax_tree/node.rb', line 10880
def accept(visitor)
visitor.visit_tstring_end(self)
end
|
#child_nodes ⇒ Object
Also known as:
deconstruct
10884
10885
10886
|
# File 'lib/syntax_tree/node.rb', line 10884
def child_nodes
[]
end
|
#copy(value: nil, location: nil) ⇒ Object
10888
10889
10890
10891
10892
10893
|
# File 'lib/syntax_tree/node.rb', line 10888
def copy(value: nil, location: nil)
TStringEnd.new(
value: value || self.value,
location: location || self.location
)
end
|
#deconstruct_keys(_keys) ⇒ Object
10897
10898
10899
|
# File 'lib/syntax_tree/node.rb', line 10897
def deconstruct_keys(_keys)
{ value: value, location: location }
end
|