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.
4990
4991
4992
4993
|
# File 'lib/syntax_tree/node.rb', line 4990
def initialize(value:, location:)
@value = value
@location = location
end
|
Instance Attribute Details
#value ⇒ Object
- String
-
the #{ used in the string
4988
4989
4990
|
# File 'lib/syntax_tree/node.rb', line 4988
def value
@value
end
|
Instance Method Details
#===(other) ⇒ Object
5016
5017
5018
|
# File 'lib/syntax_tree/node.rb', line 5016
def ===(other)
other.is_a?(EmbExprBeg) && value === other.value
end
|
#accept(visitor) ⇒ Object
4995
4996
4997
|
# File 'lib/syntax_tree/node.rb', line 4995
def accept(visitor)
visitor.visit_embexpr_beg(self)
end
|
#child_nodes ⇒ Object
Also known as:
deconstruct
4999
5000
5001
|
# File 'lib/syntax_tree/node.rb', line 4999
def child_nodes
[]
end
|
#copy(value: nil, location: nil) ⇒ Object
5003
5004
5005
5006
5007
5008
|
# File 'lib/syntax_tree/node.rb', line 5003
def copy(value: nil, location: nil)
EmbExprBeg.new(
value: value || self.value,
location: location || self.location
)
end
|
#deconstruct_keys(_keys) ⇒ Object
5012
5013
5014
|
# File 'lib/syntax_tree/node.rb', line 5012
def deconstruct_keys(_keys)
{ value: value, location: location }
end
|