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
4944
4945
4946
4947
|
# File 'lib/syntax_tree/node.rb', line 4944
def initialize(value:, location:)
@value = value
@location = location
end
|
Instance Attribute Details
#value ⇒ Object
- String
-
the #{ used in the string
4942
4943
4944
|
# File 'lib/syntax_tree/node.rb', line 4942
def value
@value
end
|
Instance Method Details
#===(other) ⇒ Object
4970
4971
4972
|
# File 'lib/syntax_tree/node.rb', line 4970
def ===(other)
other.is_a?(EmbExprBeg) && value === other.value
end
|
#accept(visitor) ⇒ Object
4949
4950
4951
|
# File 'lib/syntax_tree/node.rb', line 4949
def accept(visitor)
visitor.visit_embexpr_beg(self)
end
|
#child_nodes ⇒ Object
Also known as:
deconstruct
4953
4954
4955
|
# File 'lib/syntax_tree/node.rb', line 4953
def child_nodes
[]
end
|
#copy(value: nil, location: nil) ⇒ Object
4957
4958
4959
4960
4961
4962
|
# File 'lib/syntax_tree/node.rb', line 4957
def copy(value: nil, location: nil)
EmbExprBeg.new(
value: value || self.value,
location: location || self.location
)
end
|
#deconstruct_keys(_keys) ⇒ Object
4966
4967
4968
|
# File 'lib/syntax_tree/node.rb', line 4966
def deconstruct_keys(_keys)
{ value: value, location: location }
end
|