Class: Prism::LocalVariableTargetNode
- Inherits:
-
PrismNode
- Object
- PrismNode
- Prism::LocalVariableTargetNode
- Defined in:
- lib/prism/node.rb,
sig/generated/prism/node.rbs,
ext/prism/api_node.c
Overview
Represents writing to a local variable in a context that doesn't have an explicit value.
foo, bar = baz
^^^ ^^^
foo => baz
^^^
Class Method Summary collapse
-
.type ⇒ :local_variable_target_node
See
Node.type.
Instance Method Summary collapse
-
#===(other) ⇒ boolish
: (untyped other) -> boolish.
-
#accept(visitor) ⇒ Object
See Node.accept.
-
#child_nodes ⇒ Array[node?]
(also: #deconstruct)
See Node.child_nodes.
-
#compact_child_nodes ⇒ Array[node]
See Node.compact_child_nodes.
-
#copy(node_id: self.node_id, location: self.location, flags: self.flags, name: self.name, depth: self.depth) ⇒ LocalVariableTargetNode
:call-seq: copy(**fields) -> LocalVariableTargetNode.
-
#deconstruct_keys(keys) ⇒ Hash[Symbol, untyped]
: (Array? keys) -> Hash[Symbol, untyped].
-
#depth ⇒ Integer
:call-seq: depth -> Integer.
-
#each_child_node {|arg0| ... } ⇒ Object
See Node.each_child_node.
-
#initialize(source, node_id, location, flags, name, depth) ⇒ LocalVariableTargetNode
constructor
Initialize a new LocalVariableTargetNode node.
-
#inspect ⇒ String
: () -> String.
-
#name ⇒ Symbol
:call-seq: name -> Symbol.
-
#type ⇒ :local_variable_target_node
See
Node#type.
Constructor Details
#initialize(source, node_id, location, flags, name, depth) ⇒ LocalVariableTargetNode
Initialize a new LocalVariableTargetNode node.
: (Source source, Integer node_id, Location location, Integer flags, Symbol name, Integer depth) -> void
22231 22232 22233 22234 22235 22236 22237 22238 |
# File 'lib/prism/node.rb', line 22231 def initialize(source, node_id, location, flags, name, depth) @source = source @node_id = node_id @location = location @flags = flags @name = name @depth = depth end |
Class Method Details
.type ⇒ :local_variable_target_node
See Node.type.
: () -> :local_variable_target_node
22317 22318 22319 |
# File 'lib/prism/node.rb', line 22317 def self.type :local_variable_target_node end |
Instance Method Details
#===(other) ⇒ boolish
: (untyped other) -> boolish
22353 22354 22355 22356 22357 |
# File 'lib/prism/node.rb', line 22353 def ===(other) # :nodoc: other.is_a?(LocalVariableTargetNode) && (name === other.name) && (depth === other.depth) end |
#accept(visitor) ⇒ Object
See Node.accept.
: (_Visitor visitor) -> untyped
22254 22255 22256 |
# File 'lib/prism/node.rb', line 22254 def accept(visitor) visitor.visit_local_variable_target_node(self) end |
#child_nodes ⇒ Array[node?] Also known as: deconstruct
See Node.child_nodes.
: () -> Array
22261 22262 22263 |
# File 'lib/prism/node.rb', line 22261 def child_nodes [] end |
#compact_child_nodes ⇒ Array[node]
See Node.compact_child_nodes.
: () -> Array
22277 22278 22279 |
# File 'lib/prism/node.rb', line 22277 def compact_child_nodes [] end |
#copy(node_id: self.node_id, location: self.location, flags: self.flags, name: self.name, depth: self.depth) ⇒ LocalVariableTargetNode
:call-seq:
copy(**fields) -> LocalVariableTargetNode
Creates a copy of self with the given fields, using self as the template.
: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?depth: Integer) -> LocalVariableTargetNode
22287 22288 22289 |
# File 'lib/prism/node.rb', line 22287 def copy(node_id: self.node_id, location: self.location, flags: self.flags, name: self.name, depth: self.depth) LocalVariableTargetNode.new(source, node_id, location, flags, name, depth) end |
#deconstruct_keys(keys) ⇒ Hash[Symbol, untyped]
: (Array? keys) -> Hash[Symbol, untyped]
22294 22295 22296 22297 22298 22299 22300 22301 22302 22303 22304 22305 |
# File 'lib/prism/node.rb', line 22294 def deconstruct_keys(keys) # :nodoc: (keys || %i[node_id location name depth]).each_with_object( {} #: Hash[Symbol, untyped] ) do |key, deconstructed| case key when :node_id then deconstructed[:node_id] = self.node_id when :location then deconstructed[:location] = self.location when :name then deconstructed[:name] = self.name when :depth then deconstructed[:depth] = self.depth end end end |
#depth ⇒ Integer
:call-seq:
depth -> Integer
Returns the depth attribute.
: () -> Integer
22344 22345 22346 |
# File 'lib/prism/node.rb', line 22344 def depth @depth end |
#each_child_node ⇒ Enumerator[node, void] #each_child_node ⇒ void
See Node.each_child_node.
: () -> Enumerator[node, void] : () { (node) -> void } -> void
22269 22270 22271 22272 |
# File 'lib/prism/node.rb', line 22269 def each_child_node(&blk) return to_enum(:each_child_node) unless block_given? end |
#inspect ⇒ String
: () -> String
22322 22323 22324 |
# File 'lib/prism/node.rb', line 22322 def inspect # :nodoc: InspectVisitor.compose(self) end |
#name ⇒ Symbol
:call-seq:
name -> Symbol
Returns the name attribute.
: () -> Symbol
22334 22335 22336 |
# File 'lib/prism/node.rb', line 22334 def name @name end |
#type ⇒ :local_variable_target_node
See Node#type.
: () -> :local_variable_target_node
22310 22311 22312 |
# File 'lib/prism/node.rb', line 22310 def type :local_variable_target_node end |