class YARP::EmbeddedVariableNode

Represents an interpolated variable.

"foo #@bar"
     ^^^^^

Attributes

operator_loc[R]

attr_reader operator_loc: Location

variable[R]

attr_reader variable: Node

Public Class Methods

new(operator_loc, variable, location) click to toggle source

def initialize: (operator_loc: Location, variable: Node, location: Location) -> void

# File yarp/node.rb, line 3891
def initialize(operator_loc, variable, location)
  @operator_loc = operator_loc
  @variable = variable
  @location = location
end

Public Instance Methods

accept(visitor) click to toggle source

def accept: (visitor: Visitor) -> void

# File yarp/node.rb, line 3898
def accept(visitor)
  visitor.visit_embedded_variable_node(self)
end
child_nodes() click to toggle source

def child_nodes: () -> Array[nil | Node]

# File yarp/node.rb, line 3903
def child_nodes
  [variable]
end
Also aliased as: deconstruct
comment_targets() click to toggle source

def comment_targets: () -> Array[Node | Location]

# File yarp/node.rb, line 3908
def comment_targets
  [operator_loc, variable]
end
copy(**params) click to toggle source

def copy: (**params) -> EmbeddedVariableNode

# File yarp/node.rb, line 3913
def copy(**params)
  EmbeddedVariableNode.new(
    params.fetch(:operator_loc) { operator_loc },
    params.fetch(:variable) { variable },
    params.fetch(:location) { location },
  )
end
deconstruct()

def deconstruct: () -> Array[nil | Node]

Alias for: child_nodes
deconstruct_keys(keys) click to toggle source

def deconstruct_keys: (keys: Array) -> Hash[Symbol, nil | Node | Array | String | Token | Array | Location]

# File yarp/node.rb, line 3925
def deconstruct_keys(keys)
  { operator_loc: operator_loc, variable: variable, location: location }
end
inspect(inspector = NodeInspector.new) click to toggle source
# File yarp/node.rb, line 3934
def inspect(inspector = NodeInspector.new)
  inspector << inspector.header(self)
  inspector << "├── operator_loc: #{inspector.location(operator_loc)}\n"
  inspector << "└── variable:\n"
  inspector << inspector.child_node(variable, "    ")
  inspector.to_str
end
operator() click to toggle source

def operator: () -> String

# File yarp/node.rb, line 3930
def operator
  operator_loc.slice
end