class YARP::LocalVariableTargetNode

Represents writing to a local variable in a context that doesn’t have an explicit value.

foo, bar = baz
^^^  ^^^

Attributes

depth[R]

attr_reader depth: Integer

name[R]

attr_reader name: Symbol

Public Class Methods

new(name, depth, location) click to toggle source

def initialize: (name: Symbol, depth: Integer, location: Location) -> void

# File lib/yarp/node.rb, line 7593
def initialize(name, depth, location)
  @name = name
  @depth = depth
  @location = location
end

Public Instance Methods

accept(visitor) click to toggle source

def accept: (visitor: Visitor) -> void

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

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

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

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

# File lib/yarp/node.rb, line 7615
def comment_targets
  []
end
compact_child_nodes() click to toggle source

def compact_child_nodes: () -> Array

# File lib/yarp/node.rb, line 7610
def compact_child_nodes
  []
end
copy(**params) click to toggle source

def copy: (**params) -> LocalVariableTargetNode

# File lib/yarp/node.rb, line 7620
def copy(**params)
  LocalVariableTargetNode.new(
    params.fetch(:name) { name },
    params.fetch(:depth) { depth },
    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 lib/yarp/node.rb, line 7632
def deconstruct_keys(keys)
  { name: name, depth: depth, location: location }
end
inspect(inspector = NodeInspector.new) click to toggle source
# File lib/yarp/node.rb, line 7636
def inspect(inspector = NodeInspector.new)
  inspector << inspector.header(self)
  inspector << "├── name: #{name.inspect}\n"
  inspector << "└── depth: #{depth.inspect}\n"
  inspector.to_str
end