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.
5039
5040
5041
5042
|
# File 'lib/syntax_tree/node.rb', line 5039
def initialize(value:, location:)
@value = value
@location = location
end
|
Instance Attribute Details
#value ⇒ Object
- String
-
the #{ used in the string
5037
5038
5039
|
# File 'lib/syntax_tree/node.rb', line 5037
def value
@value
end
|
Instance Method Details
#===(other) ⇒ Object
5065
5066
5067
|
# File 'lib/syntax_tree/node.rb', line 5065
def ===(other)
other.is_a?(EmbExprBeg) && value === other.value
end
|
#accept(visitor) ⇒ Object
5044
5045
5046
|
# File 'lib/syntax_tree/node.rb', line 5044
def accept(visitor)
visitor.visit_embexpr_beg(self)
end
|
#child_nodes ⇒ Object
Also known as:
deconstruct
5048
5049
5050
|
# File 'lib/syntax_tree/node.rb', line 5048
def child_nodes
[]
end
|
#copy(value: nil, location: nil) ⇒ Object
5052
5053
5054
5055
5056
5057
|
# File 'lib/syntax_tree/node.rb', line 5052
def copy(value: nil, location: nil)
EmbExprBeg.new(
value: value || self.value,
location: location || self.location
)
end
|
#deconstruct_keys(_keys) ⇒ Object
5061
5062
5063
|
# File 'lib/syntax_tree/node.rb', line 5061
def deconstruct_keys(_keys)
{ value: value, location: location }
end
|