Class: SyntaxTree::EmbVar

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

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#child_nodes, #deconstruct, #deconstruct_keys, #format, #pretty_print, #to_json

Constructor Details

#initialize(value:, location:) ⇒ EmbVar

Returns a new instance of EmbVar.



4908
4909
4910
4911
# File 'lib/syntax_tree/node.rb', line 4908

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

Instance Attribute Details

#locationObject (readonly)

Location

the location of this node



4906
4907
4908
# File 'lib/syntax_tree/node.rb', line 4906

def location
  @location
end

#valueObject (readonly)

String

the # used in the string



4903
4904
4905
# File 'lib/syntax_tree/node.rb', line 4903

def value
  @value
end