1. Prism::
  2. ClassVariableWriteNode

class Prism::ClassVariableWriteNode

Represents writing to a class variable.

@@foo = 1^^^^^^^^^

Attributes

name[R]

The name of the class variable, which is a@@ followed by anidentifier.

@@abc =123# name `@@abc`@@_test =:test# name `@@_test`
value[R]

The value to write to the class variable. This can be anynon-void expression.

@@foo = :bar        ^^^^@@_xyz = 123         ^^^

Public Class Methods

Source
# File lib/prism/node.rb, line 4541definitialize(source,node_id,location,flags,name,name_loc,value,operator_loc)@source =source@node_id =node_id@location =location@flags =flags@name =name@name_loc =name_loc@value =value@operator_loc =operator_locend

Initialize a newClassVariableWriteNode node.

Source
# File lib/prism/node.rb, line 4649defself.type:class_variable_write_nodeend

Return a symbol representation of this node type. SeeNode::type.

Public Instance Methods

Source
# File lib/prism/node.rb, line 4655def===(other)other.is_a?(ClassVariableWriteNode)&&    (name===other.name)&&    (name_loc.nil?==other.name_loc.nil?)&&    (value===other.value)&&    (operator_loc.nil?==other.operator_loc.nil?)end

Implements case-equality for the node. This is effectively == but without comparing the value of locations. Locations are checked only for presence.

Source
# File lib/prism/node.rb, line 4553defaccept(visitor)visitor.visit_class_variable_write_node(self)end

def accept: (Visitor visitor) -> void

Source
# File lib/prism/node.rb, line 4558defchild_nodes  [value]end

defchild_nodes: () ->Array

Also aliased as:deconstruct
Source
# File lib/prism/node.rb, line 4568defcomment_targets  [name_loc,value,operator_loc]#: Array[Prism::node | Location]end

defcomment_targets: () -> Array[Node | Location]

Source
# File lib/prism/node.rb, line 4563defcompact_child_nodes  [value]end

defcompact_child_nodes: () ->Array

Source
# File lib/prism/node.rb, line 4573defcopy(node_id:self.node_id,location:self.location,flags:self.flags,name:self.name,name_loc:self.name_loc,value:self.value,operator_loc:self.operator_loc)ClassVariableWriteNode.new(source,node_id,location,flags,name,name_loc,value,operator_loc)end

def copy: (?node_id:Integer, ?location:Location, ?flags:Integer, ?name:Symbol, ?name_loc:Location, ?value: Prism::node, ?operator_loc:Location) ->ClassVariableWriteNode

def deconstruct: () ->Array

Alias for:child_nodes
Source
# File lib/prism/node.rb, line 4581defdeconstruct_keys(keys)  {node_id:node_id,location:location,name:name,name_loc:name_loc,value:value,operator_loc:operator_loc }end

defdeconstruct_keys: (Array keys) -> { node_id:Integer, location:Location, name:Symbol,name_loc:Location, value: Prism::node,operator_loc:Location }

Source
# File lib/prism/node.rb, line 4639definspectInspectVisitor.compose(self)end

def inspect ->String

Source
# File lib/prism/node.rb, line 4596defname_loclocation =@name_locreturnlocationiflocation.is_a?(Location)@name_loc =Location.new(source,location>>32,location&0xFFFFFFFF)end

The location of the variable name.

@@foo = :bar^^^^^
Source
# File lib/prism/node.rb, line 4634defoperatoroperator_loc.sliceend

def operator: () ->String

Source
# File lib/prism/node.rb, line 4621defoperator_loclocation =@operator_locreturnlocationiflocation.is_a?(Location)@operator_loc =Location.new(source,location>>32,location&0xFFFFFFFF)end

The location of the= operator.

@@foo = :bar      ^
Source
# File lib/prism/node.rb, line 4604defsave_name_loc(repository)repository.enter(node_id,:name_loc)end

Save thename_loc location using the given saved source so that it can be retrieved later.

Source
# File lib/prism/node.rb, line 4629defsave_operator_loc(repository)repository.enter(node_id,:operator_loc)end

Save theoperator_loc location using the given saved source so that it can be retrieved later.

Source
# File lib/prism/node.rb, line 4644deftype:class_variable_write_nodeend

Return a symbol representation of this node type. SeeNode#type.