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.
-
#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 }.
-
#each_child_node ⇒ Object
def each_child_node: () { (Prism::node) -> void } -> void | () -> Enumerator.
-
#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.
4714 4715 4716 4717 4718 4719 4720 |
# File 'lib/prism/node.rb', line 4714 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
4762 4763 4764 |
# File 'lib/prism/node.rb', line 4762 def name @name end |
Class Method Details
.type ⇒ Object
Return a symbol representation of this node type. See Node::type.
4775 4776 4777 |
# File 'lib/prism/node.rb', line 4775 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.
4781 4782 4783 4784 |
# File 'lib/prism/node.rb', line 4781 def ===(other) other.is_a?(ClassVariableTargetNode) && (name === other.name) end |
#accept(visitor) ⇒ Object
def accept: (Visitor visitor) -> void
4723 4724 4725 |
# File 'lib/prism/node.rb', line 4723 def accept(visitor) visitor.visit_class_variable_target_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array
4728 4729 4730 |
# File 'lib/prism/node.rb', line 4728 def child_nodes [] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
4744 4745 4746 |
# File 'lib/prism/node.rb', line 4744 def comment_targets [] #: Array[Prism::node | Location] end |
#compact_child_nodes ⇒ Object
def compact_child_nodes: () -> Array
4739 4740 4741 |
# File 'lib/prism/node.rb', line 4739 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
4749 4750 4751 |
# File 'lib/prism/node.rb', line 4749 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 }
4757 4758 4759 |
# File 'lib/prism/node.rb', line 4757 def deconstruct_keys(keys) { node_id: node_id, location: location, name: name } end |
#each_child_node ⇒ Object
def each_child_node: () { (Prism::node) -> void } -> void | () -> Enumerator
4733 4734 4735 4736 |
# File 'lib/prism/node.rb', line 4733 def each_child_node return to_enum(:each_child_node) unless block_given? end |
#inspect ⇒ Object
def inspect -> String
4765 4766 4767 |
# File 'lib/prism/node.rb', line 4765 def inspect InspectVisitor.compose(self) end |
#type ⇒ Object
Return a symbol representation of this node type. See ‘Node#type`.
4770 4771 4772 |
# File 'lib/prism/node.rb', line 4770 def type :class_variable_target_node end |