Class: Prism::InstanceVariableTargetNode
- Inherits:
-
PrismNode
- Object
- PrismNode
- Prism::InstanceVariableTargetNode
- Defined in:
- lib/prism/node.rb,
ext/prism/api_node.c
Overview
Represents writing to an instance 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) -> InstanceVariableTargetNode.
-
#deconstruct_keys(keys) ⇒ Object
def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, name: Symbol }.
-
#initialize(source, node_id, location, flags, name) ⇒ InstanceVariableTargetNode
constructor
Initialize a new InstanceVariableTargetNode 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) ⇒ InstanceVariableTargetNode
Initialize a new InstanceVariableTargetNode node.
10325 10326 10327 10328 10329 10330 10331 |
# File 'lib/prism/node.rb', line 10325 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
10367 10368 10369 |
# File 'lib/prism/node.rb', line 10367 def name @name end |
Class Method Details
.type ⇒ Object
Return a symbol representation of this node type. See ‘Node::type`.
10380 10381 10382 |
# File 'lib/prism/node.rb', line 10380 def self.type :instance_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.
10386 10387 10388 10389 |
# File 'lib/prism/node.rb', line 10386 def ===(other) other.is_a?(InstanceVariableTargetNode) && (name === other.name) end |
#accept(visitor) ⇒ Object
def accept: (Visitor visitor) -> void
10334 10335 10336 |
# File 'lib/prism/node.rb', line 10334 def accept(visitor) visitor.visit_instance_variable_target_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array
10339 10340 10341 |
# File 'lib/prism/node.rb', line 10339 def child_nodes [] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
10349 10350 10351 |
# File 'lib/prism/node.rb', line 10349 def comment_targets [] #: Array[Prism::node | Location] end |
#compact_child_nodes ⇒ Object
def compact_child_nodes: () -> Array
10344 10345 10346 |
# File 'lib/prism/node.rb', line 10344 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) -> InstanceVariableTargetNode
10354 10355 10356 |
# File 'lib/prism/node.rb', line 10354 def copy(node_id: self.node_id, location: self.location, flags: self.flags, name: self.name) InstanceVariableTargetNode.new(source, node_id, location, flags, name) end |
#deconstruct_keys(keys) ⇒ Object
def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, name: Symbol }
10362 10363 10364 |
# File 'lib/prism/node.rb', line 10362 def deconstruct_keys(keys) { node_id: node_id, location: location, name: name } end |
#inspect ⇒ Object
def inspect -> String
10370 10371 10372 |
# File 'lib/prism/node.rb', line 10370 def inspect InspectVisitor.compose(self) end |
#type ⇒ Object
Return a symbol representation of this node type. See ‘Node#type`.
10375 10376 10377 |
# File 'lib/prism/node.rb', line 10375 def type :instance_variable_target_node end |