Class: Prism::InstanceVariableTargetNode
- Inherits:
-
PrismNode
- Object
- PrismNode
- Prism::InstanceVariableTargetNode
- Defined in:
- lib/prism/node.rb,
sig/generated/prism/node.rbs,
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
^^^^ ^^^^
Class Method Summary collapse
-
.type ⇒ :instance_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) ⇒ InstanceVariableTargetNode
:call-seq: copy(**fields) -> InstanceVariableTargetNode.
-
#deconstruct_keys(keys) ⇒ Hash[Symbol, untyped]
: (Array? keys) -> Hash[Symbol, untyped].
-
#each_child_node {|arg0| ... } ⇒ Object
See Node.each_child_node.
-
#initialize(source, node_id, location, flags, name) ⇒ InstanceVariableTargetNode
constructor
Initialize a new InstanceVariableTargetNode node.
-
#inspect ⇒ String
: () -> String.
-
#name ⇒ Symbol
:call-seq: name -> Symbol.
-
#type ⇒ :instance_variable_target_node
See
Node#type.
Constructor Details
#initialize(source, node_id, location, flags, name) ⇒ InstanceVariableTargetNode
Initialize a new InstanceVariableTargetNode node.
: (Source source, Integer node_id, Location location, Integer flags, Symbol name) -> void
18754 18755 18756 18757 18758 18759 18760 |
# File 'lib/prism/node.rb', line 18754 def initialize(source, node_id, location, flags, name) @source = source @node_id = node_id @location = location @flags = flags @name = name end |
Class Method Details
.type ⇒ :instance_variable_target_node
See Node.type.
: () -> :instance_variable_target_node
18838 18839 18840 |
# File 'lib/prism/node.rb', line 18838 def self.type :instance_variable_target_node end |
Instance Method Details
#===(other) ⇒ boolish
: (untyped other) -> boolish
18864 18865 18866 18867 |
# File 'lib/prism/node.rb', line 18864 def ===(other) # :nodoc: other.is_a?(InstanceVariableTargetNode) && (name === other.name) end |
#accept(visitor) ⇒ Object
See Node.accept.
: (_Visitor visitor) -> untyped
18776 18777 18778 |
# File 'lib/prism/node.rb', line 18776 def accept(visitor) visitor.visit_instance_variable_target_node(self) end |
#child_nodes ⇒ Array[node?] Also known as: deconstruct
See Node.child_nodes.
: () -> Array
18783 18784 18785 |
# File 'lib/prism/node.rb', line 18783 def child_nodes [] end |
#compact_child_nodes ⇒ Array[node]
See Node.compact_child_nodes.
: () -> Array
18799 18800 18801 |
# File 'lib/prism/node.rb', line 18799 def compact_child_nodes [] end |
#copy(node_id: self.node_id, location: self.location, flags: self.flags, name: self.name) ⇒ InstanceVariableTargetNode
:call-seq:
copy(**fields) -> InstanceVariableTargetNode
Creates a copy of self with the given fields, using self as the template.
: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> InstanceVariableTargetNode
18809 18810 18811 |
# File 'lib/prism/node.rb', line 18809 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) ⇒ Hash[Symbol, untyped]
: (Array? keys) -> Hash[Symbol, untyped]
18816 18817 18818 18819 18820 18821 18822 18823 18824 18825 18826 |
# File 'lib/prism/node.rb', line 18816 def deconstruct_keys(keys) # :nodoc: (keys || %i[node_id location name]).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 end end end |
#each_child_node ⇒ Enumerator[node, void] #each_child_node ⇒ void
See Node.each_child_node.
: () -> Enumerator[node, void] : () { (node) -> void } -> void
18791 18792 18793 18794 |
# File 'lib/prism/node.rb', line 18791 def each_child_node(&blk) return to_enum(:each_child_node) unless block_given? end |
#inspect ⇒ String
: () -> String
18843 18844 18845 |
# File 'lib/prism/node.rb', line 18843 def inspect # :nodoc: InspectVisitor.compose(self) end |
#name ⇒ Symbol
:call-seq:
name -> Symbol
Returns the name attribute.
: () -> Symbol
18855 18856 18857 |
# File 'lib/prism/node.rb', line 18855 def name @name end |
#type ⇒ :instance_variable_target_node
See Node#type.
: () -> :instance_variable_target_node
18831 18832 18833 |
# File 'lib/prism/node.rb', line 18831 def type :instance_variable_target_node end |