Class: SyntaxTree::TStringBeg
- Inherits:
-
Node
- Object
- Node
- SyntaxTree::TStringBeg
show all
- Defined in:
- lib/syntax_tree/node.rb
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
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:) ⇒ TStringBeg
10797
10798
10799
10800
|
# File 'lib/syntax_tree/node.rb', line 10797
def initialize(value:, location:)
@value = value
@location = location
end
|
Instance Attribute Details
#value ⇒ Object
- String
-
the beginning of the string
10795
10796
10797
|
# File 'lib/syntax_tree/node.rb', line 10795
def value
@value
end
|
Instance Method Details
#===(other) ⇒ Object
10823
10824
10825
|
# File 'lib/syntax_tree/node.rb', line 10823
def ===(other)
other.is_a?(TStringBeg) && value === other.value
end
|
#accept(visitor) ⇒ Object
10802
10803
10804
|
# File 'lib/syntax_tree/node.rb', line 10802
def accept(visitor)
visitor.visit_tstring_beg(self)
end
|
#child_nodes ⇒ Object
Also known as:
deconstruct
10806
10807
10808
|
# File 'lib/syntax_tree/node.rb', line 10806
def child_nodes
[]
end
|
#copy(value: nil, location: nil) ⇒ Object
10810
10811
10812
10813
10814
10815
|
# File 'lib/syntax_tree/node.rb', line 10810
def copy(value: nil, location: nil)
TStringBeg.new(
value: value || self.value,
location: location || self.location
)
end
|
#deconstruct_keys(_keys) ⇒ Object
10819
10820
10821
|
# File 'lib/syntax_tree/node.rb', line 10819
def deconstruct_keys(_keys)
{ value: value, location: location }
end
|