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

#format, #pretty_print, #to_json

Constructor Details

#initialize(value:, location:) ⇒ EmbExprBeg

Returns a new instance of EmbExprBeg.



4120
4121
4122
4123
# File 'lib/syntax_tree/node.rb', line 4120

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

Instance Attribute Details

#valueObject (readonly)

String

the #{ used in the string



4118
4119
4120
# File 'lib/syntax_tree/node.rb', line 4118

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



4125
4126
4127
# File 'lib/syntax_tree/node.rb', line 4125

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

#child_nodesObject Also known as: deconstruct



4129
4130
4131
# File 'lib/syntax_tree/node.rb', line 4129

def child_nodes
  []
end

#deconstruct_keys(keys) ⇒ Object



4135
4136
4137
# File 'lib/syntax_tree/node.rb', line 4135

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