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.
4935
4936
4937
4938
|
# File 'lib/syntax_tree/node.rb', line 4935
def initialize(value:, location:)
@value = value
@location = location
end
|
Instance Attribute Details
#value ⇒ Object
- String
-
the #{ used in the string
4933
4934
4935
|
# File 'lib/syntax_tree/node.rb', line 4933
def value
@value
end
|
Instance Method Details
#===(other) ⇒ Object
4961
4962
4963
|
# File 'lib/syntax_tree/node.rb', line 4961
def ===(other)
other.is_a?(EmbExprBeg) && value === other.value
end
|
#accept(visitor) ⇒ Object
4940
4941
4942
|
# File 'lib/syntax_tree/node.rb', line 4940
def accept(visitor)
visitor.visit_embexpr_beg(self)
end
|
#child_nodes ⇒ Object
Also known as:
deconstruct
4944
4945
4946
|
# File 'lib/syntax_tree/node.rb', line 4944
def child_nodes
[]
end
|
#copy(value: nil, location: nil) ⇒ Object
4948
4949
4950
4951
4952
4953
|
# File 'lib/syntax_tree/node.rb', line 4948
def copy(value: nil, location: nil)
EmbExprBeg.new(
value: value || self.value,
location: location || self.location
)
end
|
#deconstruct_keys(_keys) ⇒ Object
4957
4958
4959
|
# File 'lib/syntax_tree/node.rb', line 4957
def deconstruct_keys(_keys)
{ value: value, location: location }
end
|