Class: SyntaxTree::TStringBeg
Overview
TStringBeg represents the beginning of a string literal.
"string"
In the example above, TStringBeg represents the first 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
-
#value ⇒ Object
readonly
- String
-
the beginning of the string.
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:) ⇒ TStringBeg
constructor
A new instance of TStringBeg.
Methods inherited from Node
#construct_keys, #end_char, #format, #pretty_print, #start_char, #to_json, #to_mermaid
Constructor Details
#initialize(value:, location:) ⇒ TStringBeg
Returns a new instance of TStringBeg.
10954 10955 10956 10957 |
# File 'lib/syntax_tree/node.rb', line 10954 def initialize(value:, location:) @value = value @location = location end |
Instance Attribute Details
#value ⇒ Object (readonly)
- String
-
the beginning of the string
10952 10953 10954 |
# File 'lib/syntax_tree/node.rb', line 10952 def value @value end |
Instance Method Details
#===(other) ⇒ Object
10980 10981 10982 |
# File 'lib/syntax_tree/node.rb', line 10980 def ===(other) other.is_a?(TStringBeg) && value === other.value end |
#accept(visitor) ⇒ Object
10959 10960 10961 |
# File 'lib/syntax_tree/node.rb', line 10959 def accept(visitor) visitor.visit_tstring_beg(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
10963 10964 10965 |
# File 'lib/syntax_tree/node.rb', line 10963 def child_nodes [] end |
#copy(value: nil, location: nil) ⇒ Object
10967 10968 10969 10970 10971 10972 |
# File 'lib/syntax_tree/node.rb', line 10967 def copy(value: nil, location: nil) TStringBeg.new( value: value || self.value, location: location || self.location ) end |
#deconstruct_keys(_keys) ⇒ Object
10976 10977 10978 |
# File 'lib/syntax_tree/node.rb', line 10976 def deconstruct_keys(_keys) { value: value, location: location } end |