Class: Prism::InstanceVariableReadNode
- Inherits:
-
PrismNode
- Object
- PrismNode
- Prism::InstanceVariableReadNode
- Defined in:
- lib/prism/node.rb,
sig/generated/prism/node.rbs,
ext/prism/api_node.c
Overview
Class Method Summary collapse
-
.type ⇒ :instance_variable_read_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) ⇒ InstanceVariableReadNode
:call-seq: copy(**fields) -> InstanceVariableReadNode.
-
#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) ⇒ InstanceVariableReadNode
constructor
Initialize a new InstanceVariableReadNode node.
-
#inspect ⇒ String
: () -> String.
-
#name ⇒ Symbol
:call-seq: name -> Symbol.
-
#type ⇒ :instance_variable_read_node
See
Node#type.
Constructor Details
#initialize(source, node_id, location, flags, name) ⇒ InstanceVariableReadNode
Initialize a new InstanceVariableReadNode node.
: (Source source, Integer node_id, Location location, Integer flags, Symbol name) -> void
18616 18617 18618 18619 18620 18621 18622 |
# File 'lib/prism/node.rb', line 18616 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_read_node
See Node.type.
: () -> :instance_variable_read_node
18700 18701 18702 |
# File 'lib/prism/node.rb', line 18700 def self.type :instance_variable_read_node end |
Instance Method Details
#===(other) ⇒ boolish
: (untyped other) -> boolish
18734 18735 18736 18737 |
# File 'lib/prism/node.rb', line 18734 def ===(other) # :nodoc: other.is_a?(InstanceVariableReadNode) && (name === other.name) end |
#accept(visitor) ⇒ Object
See Node.accept.
: (_Visitor visitor) -> untyped
18638 18639 18640 |
# File 'lib/prism/node.rb', line 18638 def accept(visitor) visitor.visit_instance_variable_read_node(self) end |
#child_nodes ⇒ Array[node?] Also known as: deconstruct
See Node.child_nodes.
: () -> Array
18645 18646 18647 |
# File 'lib/prism/node.rb', line 18645 def child_nodes [] end |
#compact_child_nodes ⇒ Array[node]
See Node.compact_child_nodes.
: () -> Array
18661 18662 18663 |
# File 'lib/prism/node.rb', line 18661 def compact_child_nodes [] end |
#copy(node_id: self.node_id, location: self.location, flags: self.flags, name: self.name) ⇒ InstanceVariableReadNode
:call-seq:
copy(**fields) -> InstanceVariableReadNode
Creates a copy of self with the given fields, using self as the template.
: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> InstanceVariableReadNode
18671 18672 18673 |
# File 'lib/prism/node.rb', line 18671 def copy(node_id: self.node_id, location: self.location, flags: self.flags, name: self.name) InstanceVariableReadNode.new(source, node_id, location, flags, name) end |
#deconstruct_keys(keys) ⇒ Hash[Symbol, untyped]
: (Array? keys) -> Hash[Symbol, untyped]
18678 18679 18680 18681 18682 18683 18684 18685 18686 18687 18688 |
# File 'lib/prism/node.rb', line 18678 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
18653 18654 18655 18656 |
# File 'lib/prism/node.rb', line 18653 def each_child_node(&blk) return to_enum(:each_child_node) unless block_given? end |
#inspect ⇒ String
: () -> String
18705 18706 18707 |
# File 'lib/prism/node.rb', line 18705 def inspect # :nodoc: InspectVisitor.compose(self) end |
#name ⇒ Symbol
:call-seq:
name -> Symbol
The name of the instance variable, which is a @ followed by an identifier.
</code>
: () -> Symbol
18725 18726 18727 |
# File 'lib/prism/node.rb', line 18725 def name @name end |
#type ⇒ :instance_variable_read_node
See Node#type.
: () -> :instance_variable_read_node
18693 18694 18695 |
# File 'lib/prism/node.rb', line 18693 def type :instance_variable_read_node end |