Class: YARP::ClassVariableReadNode

Inherits:
YARPNode
  • Object
show all
Defined in:
lib/yarp/node.rb,
ext/yarp/api_node.c

Overview

Represents referencing a class variable.

@@foo
^^^^^

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, location) ⇒ ClassVariableReadNode

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



1599
1600
1601
1602
# File 'lib/yarp/node.rb', line 1599

def initialize(name, location)
  @name = name
  @location = location
end

Instance Attribute Details

#nameObject (readonly)

attr_reader name: Symbol



1596
1597
1598
# File 'lib/yarp/node.rb', line 1596

def name
  @name
end

Instance Method Details

#accept(visitor) ⇒ Object

def accept: (visitor: Visitor) -> void



1605
1606
1607
# File 'lib/yarp/node.rb', line 1605

def accept(visitor)
  visitor.visit_class_variable_read_node(self)
end

#child_nodesObject Also known as: deconstruct

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



1610
1611
1612
# File 'lib/yarp/node.rb', line 1610

def child_nodes
  []
end

#copy(**params) ⇒ Object

def copy: (**params) -> ClassVariableReadNode



1615
1616
1617
1618
1619
1620
# File 'lib/yarp/node.rb', line 1615

def copy(**params)
  ClassVariableReadNode.new(
    params.fetch(:name) { name },
    params.fetch(:location) { location },
  )
end

#deconstruct_keys(keys) ⇒ Object

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



1626
1627
1628
# File 'lib/yarp/node.rb', line 1626

def deconstruct_keys(keys)
  { name: name, location: location }
end