class YARP::ConstantTargetNode

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

Foo, Bar = baz
^^^  ^^^

Attributes

name[R]

attr_reader name: Symbol

Public Class Methods

new(name, location) click to toggle source

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

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

Public Instance Methods

accept(visitor) click to toggle source

def accept: (visitor: Visitor) -> void

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

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

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

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

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

def copy: (**params) -> ConstantTargetNode

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