Class: SyntaxTree::EmbExprEnd

Inherits:
Node
  • Object
show all
Defined in:
lib/syntax_tree/node.rb

Overview

EmbExprEnd represents the ending 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:) ⇒ EmbExprEnd

Returns a new instance of EmbExprEnd.



4222
4223
4224
4225
# File 'lib/syntax_tree/node.rb', line 4222

def initialize(value:, location:)
  @value = value
  @location = location
end

Instance Attribute Details

#value ⇒ Object (readonly)

[String] the } used in the string



4220
4221
4222
# File 'lib/syntax_tree/node.rb', line 4220

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



4227
4228
4229
# File 'lib/syntax_tree/node.rb', line 4227

def accept(visitor)
  visitor.visit_embexpr_end(self)
end

#child_nodes ⇒ Object Also known as: deconstruct



4231
4232
4233
# File 'lib/syntax_tree/node.rb', line 4231

def child_nodes
  []
end

#deconstruct_keys(_keys) ⇒ Object



4237
4238
4239
# File 'lib/syntax_tree/node.rb', line 4237

def deconstruct_keys(_keys)
  { value: value, location: location }
end