Class: Prism::ClassVariableTargetNode
- Inherits:
-
PrismNode
- Object
- PrismNode
- Prism::ClassVariableTargetNode
- Defined in:
- lib/prism/node.rb,
ext/prism/api_node.c
Overview
Represents writing to a class variable in a context that doesn’t have an explicit value.
@@foo, = baz
^^^^^ ^^^^^
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
attr_reader name: Symbol.
Class Method Summary collapse
-
.type ⇒ Object
Return a symbol representation of this node type.
Instance Method Summary collapse
-
#===(other) ⇒ Object
Implements case-equality for the node.
-
#accept(visitor) ⇒ Object
def accept: (Visitor visitor) -> void.
-
#child_nodes ⇒ Object
(also: #deconstruct)
def child_nodes: () -> Array.
-
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location].
-
#compact_child_nodes ⇒ Object
def compact_child_nodes: () -> Array.
-
#copy(node_id: self.node_id, location: self.location, flags: self.flags, name: self.name) ⇒ Object
def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> ClassVariableTargetNode.
-
#deconstruct_keys(keys) ⇒ Object
def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, name: Symbol }.
-
#initialize(source, node_id, location, flags, name) ⇒ ClassVariableTargetNode
constructor
Initialize a new ClassVariableTargetNode node.
-
#inspect ⇒ Object
def inspect -> String.
-
#type ⇒ Object
Return a symbol representation of this node type.
Constructor Details
#initialize(source, node_id, location, flags, name) ⇒ ClassVariableTargetNode
Initialize a new ClassVariableTargetNode node.
4468 4469 4470 4471 4472 4473 4474 |
# File 'lib/prism/node.rb', line 4468 def initialize(source, node_id, location, flags, name) @source = source @node_id = node_id @location = location @flags = flags @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
attr_reader name: Symbol
4510 4511 4512 |
# File 'lib/prism/node.rb', line 4510 def name @name end |
Class Method Details
.type ⇒ Object
Return a symbol representation of this node type. See ‘Node::type`.
4523 4524 4525 |
# File 'lib/prism/node.rb', line 4523 def self.type :class_variable_target_node end |
Instance Method Details
#===(other) ⇒ Object
Implements case-equality for the node. This is effectively == but without comparing the value of locations. Locations are checked only for presence.
4529 4530 4531 4532 |
# File 'lib/prism/node.rb', line 4529 def ===(other) other.is_a?(ClassVariableTargetNode) && (name === other.name) end |
#accept(visitor) ⇒ Object
def accept: (Visitor visitor) -> void
4477 4478 4479 |
# File 'lib/prism/node.rb', line 4477 def accept(visitor) visitor.visit_class_variable_target_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array
4482 4483 4484 |
# File 'lib/prism/node.rb', line 4482 def child_nodes [] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
4492 4493 4494 |
# File 'lib/prism/node.rb', line 4492 def comment_targets [] #: Array[Prism::node | Location] end |
#compact_child_nodes ⇒ Object
def compact_child_nodes: () -> Array
4487 4488 4489 |
# File 'lib/prism/node.rb', line 4487 def compact_child_nodes [] end |
#copy(node_id: self.node_id, location: self.location, flags: self.flags, name: self.name) ⇒ Object
def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> ClassVariableTargetNode
4497 4498 4499 |
# File 'lib/prism/node.rb', line 4497 def copy(node_id: self.node_id, location: self.location, flags: self.flags, name: self.name) ClassVariableTargetNode.new(source, node_id, location, flags, name) end |
#deconstruct_keys(keys) ⇒ Object
def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, name: Symbol }
4505 4506 4507 |
# File 'lib/prism/node.rb', line 4505 def deconstruct_keys(keys) { node_id: node_id, location: location, name: name } end |
#inspect ⇒ Object
def inspect -> String
4513 4514 4515 |
# File 'lib/prism/node.rb', line 4513 def inspect InspectVisitor.compose(self) end |
#type ⇒ Object
Return a symbol representation of this node type. See ‘Node#type`.
4518 4519 4520 |
# File 'lib/prism/node.rb', line 4518 def type :class_variable_target_node end |