class SyntaxTree::EmbVar

EmbVar represents the use of shorthand interpolation for an instance, class, or global variable into a parent node that accepts string content (like a string or regular expression).

"#@variable"

In the example above, an EmbVar node represents the # because it forces @variable to be interpolated.

Attributes

value[R]
String

the # used in the string

Public Class Methods

new(value:, location:) click to toggle source
# File lib/syntax_tree/node.rb, line 5126
def initialize(value:, location:)
  @value = value
  @location = location
end

Public Instance Methods

===(other) click to toggle source
# File lib/syntax_tree/node.rb, line 5152
def ===(other)
  other.is_a?(EmbVar) && value === other.value
end
accept(visitor) click to toggle source
# File lib/syntax_tree/node.rb, line 5131
def accept(visitor)
  visitor.visit_embvar(self)
end
child_nodes() click to toggle source
# File lib/syntax_tree/node.rb, line 5135
def child_nodes
  []
end
Also aliased as: deconstruct
copy(value: nil, location: nil) click to toggle source
# File lib/syntax_tree/node.rb, line 5139
def copy(value: nil, location: nil)
  EmbVar.new(
    value: value || self.value,
    location: location || self.location
  )
end
deconstruct()
Alias for: child_nodes
deconstruct_keys(_keys) click to toggle source
# File lib/syntax_tree/node.rb, line 5148
def deconstruct_keys(_keys)
  { value: value, location: location }
end