Class: SyntaxTree::EmbExprBeg

Inherits:
Node
  • Object
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.



4191
4192
4193
4194
# File 'lib/syntax_tree/node.rb', line 4191

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

Instance Attribute Details

#valueObject (readonly)

String

the #{ used in the string



4189
4190
4191
# File 'lib/syntax_tree/node.rb', line 4189

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



4196
4197
4198
# File 'lib/syntax_tree/node.rb', line 4196

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

#child_nodesObject Also known as: deconstruct



4200
4201
4202
# File 'lib/syntax_tree/node.rb', line 4200

def child_nodes
  []
end

#deconstruct_keys(_keys) ⇒ Object



4206
4207
4208
# File 'lib/syntax_tree/node.rb', line 4206

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