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, #end_char, #format, #pretty_print, #start_char, #to_json, #to_mermaid
Constructor Details
#initialize(value:, location:) ⇒ TStringEnd
11057
11058
11059
11060
|
# File 'lib/syntax_tree/node.rb', line 11057
def initialize(value:, location:)
@value = value
@location = location
end
|
Instance Attribute Details
#value ⇒ Object
[String] the end of the string
11055
11056
11057
|
# File 'lib/syntax_tree/node.rb', line 11055
def value
@value
end
|
Instance Method Details
#===(other) ⇒ Object
11083
11084
11085
|
# File 'lib/syntax_tree/node.rb', line 11083
def ===(other)
other.is_a?(TStringEnd) && value === other.value
end
|
#accept(visitor) ⇒ Object
11062
11063
11064
|
# File 'lib/syntax_tree/node.rb', line 11062
def accept(visitor)
visitor.visit_tstring_end(self)
end
|
#child_nodes ⇒ Object
Also known as:
deconstruct
11066
11067
11068
|
# File 'lib/syntax_tree/node.rb', line 11066
def child_nodes
[]
end
|
#copy(value: nil, location: nil) ⇒ Object
11070
11071
11072
11073
11074
11075
|
# File 'lib/syntax_tree/node.rb', line 11070
def copy(value: nil, location: nil)
TStringEnd.new(
value: value || self.value,
location: location || self.location
)
end
|
#deconstruct_keys(_keys) ⇒ Object
11079
11080
11081
|
# File 'lib/syntax_tree/node.rb', line 11079
def deconstruct_keys(_keys)
{ value: value, location: location }
end
|