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.
5057
5058
5059
5060
|
# File 'lib/syntax_tree/node.rb', line 5057
def initialize(value:, location:)
@value = value
@location = location
end
|
Instance Attribute Details
#value ⇒ Object
- String
-
the #{ used in the string
5055
5056
5057
|
# File 'lib/syntax_tree/node.rb', line 5055
def value
@value
end
|
Instance Method Details
#===(other) ⇒ Object
5083
5084
5085
|
# File 'lib/syntax_tree/node.rb', line 5083
def ===(other)
other.is_a?(EmbExprBeg) && value === other.value
end
|
#accept(visitor) ⇒ Object
5062
5063
5064
|
# File 'lib/syntax_tree/node.rb', line 5062
def accept(visitor)
visitor.visit_embexpr_beg(self)
end
|
#child_nodes ⇒ Object
Also known as:
deconstruct
5066
5067
5068
|
# File 'lib/syntax_tree/node.rb', line 5066
def child_nodes
[]
end
|
#copy(value: nil, location: nil) ⇒ Object
5070
5071
5072
5073
5074
5075
|
# File 'lib/syntax_tree/node.rb', line 5070
def copy(value: nil, location: nil)
EmbExprBeg.new(
value: value || self.value,
location: location || self.location
)
end
|
#deconstruct_keys(_keys) ⇒ Object
5079
5080
5081
|
# File 'lib/syntax_tree/node.rb', line 5079
def deconstruct_keys(_keys)
{ value: value, location: location }
end
|