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, @@bar = 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[nil | Node].
-
#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.
3765 3766 3767 3768 3769 3770 3771 |
# File 'lib/prism/node.rb', line 3765 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
3807 3808 3809 |
# File 'lib/prism/node.rb', line 3807 def name @name end |
Class Method Details
.type ⇒ Object
Return a symbol representation of this node type. See ‘Node::type`.
3820 3821 3822 |
# File 'lib/prism/node.rb', line 3820 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.
3826 3827 3828 3829 |
# File 'lib/prism/node.rb', line 3826 def ===(other) other.is_a?(ClassVariableTargetNode) && (name === other.name) end |
#accept(visitor) ⇒ Object
def accept: (Visitor visitor) -> void
3774 3775 3776 |
# File 'lib/prism/node.rb', line 3774 def accept(visitor) visitor.visit_class_variable_target_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
3779 3780 3781 |
# File 'lib/prism/node.rb', line 3779 def child_nodes [] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
3789 3790 3791 |
# File 'lib/prism/node.rb', line 3789 def comment_targets [] #: Array[Prism::node | Location] end |
#compact_child_nodes ⇒ Object
def compact_child_nodes: () -> Array
3784 3785 3786 |
# File 'lib/prism/node.rb', line 3784 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
3794 3795 3796 |
# File 'lib/prism/node.rb', line 3794 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 }
3802 3803 3804 |
# File 'lib/prism/node.rb', line 3802 def deconstruct_keys(keys) { node_id: node_id, location: location, name: name } end |
#inspect ⇒ Object
def inspect -> String
3810 3811 3812 |
# File 'lib/prism/node.rb', line 3810 def inspect InspectVisitor.compose(self) end |
#type ⇒ Object
Return a symbol representation of this node type. See ‘Node#type`.
3815 3816 3817 |
# File 'lib/prism/node.rb', line 3815 def type :class_variable_target_node end |