Class: SyntaxTree::EmbExprBeg
- Inherits:
-
Node
- Object
- Node
- SyntaxTree::EmbExprBeg
show all
- Defined in:
- lib/syntax_tree/node.rb
Overview
EmbExprBeg represents the beginning token for using interpolation inside of a parent node that accepts string content (like a string or regular expression).
"Hello, #{person}!"
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:) ⇒ EmbExprBeg
Returns a new instance of EmbExprBeg.
5021
5022
5023
5024
|
# File 'lib/syntax_tree/node.rb', line 5021
def initialize(value:, location:)
@value = value
@location = location
end
|
Instance Attribute Details
#value ⇒ Object
- String
-
the #{ used in the string
5019
5020
5021
|
# File 'lib/syntax_tree/node.rb', line 5019
def value
@value
end
|
Instance Method Details
#===(other) ⇒ Object
5047
5048
5049
|
# File 'lib/syntax_tree/node.rb', line 5047
def ===(other)
other.is_a?(EmbExprBeg) && value === other.value
end
|
#accept(visitor) ⇒ Object
5026
5027
5028
|
# File 'lib/syntax_tree/node.rb', line 5026
def accept(visitor)
visitor.visit_embexpr_beg(self)
end
|
#child_nodes ⇒ Object
Also known as:
deconstruct
5030
5031
5032
|
# File 'lib/syntax_tree/node.rb', line 5030
def child_nodes
[]
end
|
#copy(value: nil, location: nil) ⇒ Object
5034
5035
5036
5037
5038
5039
|
# File 'lib/syntax_tree/node.rb', line 5034
def copy(value: nil, location: nil)
EmbExprBeg.new(
value: value || self.value,
location: location || self.location
)
end
|
#deconstruct_keys(_keys) ⇒ Object
5043
5044
5045
|
# File 'lib/syntax_tree/node.rb', line 5043
def deconstruct_keys(_keys)
{ value: value, location: location }
end
|