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, #format, #pretty_print, #to_json
Constructor Details
#initialize(value:, location:) ⇒ EmbExprBeg
Returns a new instance of EmbExprBeg.
4930
4931
4932
4933
|
# File 'lib/syntax_tree/node.rb', line 4930
def initialize(value:, location:)
@value = value
@location = location
end
|
Instance Attribute Details
#value ⇒ Object
- String
-
the #{ used in the string
4928
4929
4930
|
# File 'lib/syntax_tree/node.rb', line 4928
def value
@value
end
|
Instance Method Details
#===(other) ⇒ Object
4956
4957
4958
|
# File 'lib/syntax_tree/node.rb', line 4956
def ===(other)
other.is_a?(EmbExprBeg) && value === other.value
end
|
#accept(visitor) ⇒ Object
4935
4936
4937
|
# File 'lib/syntax_tree/node.rb', line 4935
def accept(visitor)
visitor.visit_embexpr_beg(self)
end
|
#child_nodes ⇒ Object
Also known as:
deconstruct
4939
4940
4941
|
# File 'lib/syntax_tree/node.rb', line 4939
def child_nodes
[]
end
|
#copy(value: nil, location: nil) ⇒ Object
4943
4944
4945
4946
4947
4948
|
# File 'lib/syntax_tree/node.rb', line 4943
def copy(value: nil, location: nil)
EmbExprBeg.new(
value: value || self.value,
location: location || self.location
)
end
|
#deconstruct_keys(_keys) ⇒ Object
4952
4953
4954
|
# File 'lib/syntax_tree/node.rb', line 4952
def deconstruct_keys(_keys)
{ value: value, location: location }
end
|