Class: Prism::GlobalVariableReadNode
- Inherits:
-
PrismNode
- Object
- PrismNode
- Prism::GlobalVariableReadNode
- Defined in:
- lib/prism/node.rb,
sig/generated/prism/node.rbs,
ext/prism/api_node.c
Overview
Class Method Summary collapse
-
.type ⇒ :global_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) ⇒ GlobalVariableReadNode
:call-seq: copy(**fields) -> GlobalVariableReadNode.
-
#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) ⇒ GlobalVariableReadNode
constructor
Initialize a new GlobalVariableReadNode node.
-
#inspect ⇒ String
: () -> String.
-
#name ⇒ Symbol
:call-seq: name -> Symbol.
-
#type ⇒ :global_variable_read_node
See
Node#type.
Constructor Details
#initialize(source, node_id, location, flags, name) ⇒ GlobalVariableReadNode
Initialize a new GlobalVariableReadNode node.
: (Source source, Integer node_id, Location location, Integer flags, Symbol name) -> void
14570 14571 14572 14573 14574 14575 14576 |
# File 'lib/prism/node.rb', line 14570 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 ⇒ :global_variable_read_node
See Node.type.
: () -> :global_variable_read_node
14654 14655 14656 |
# File 'lib/prism/node.rb', line 14654 def self.type :global_variable_read_node end |
Instance Method Details
#===(other) ⇒ boolish
: (untyped other) -> boolish
14688 14689 14690 14691 |
# File 'lib/prism/node.rb', line 14688 def ===(other) # :nodoc: other.is_a?(GlobalVariableReadNode) && (name === other.name) end |
#accept(visitor) ⇒ Object
See Node.accept.
: (_Visitor visitor) -> untyped
14592 14593 14594 |
# File 'lib/prism/node.rb', line 14592 def accept(visitor) visitor.visit_global_variable_read_node(self) end |
#child_nodes ⇒ Array[node?] Also known as: deconstruct
See Node.child_nodes.
: () -> Array
14599 14600 14601 |
# File 'lib/prism/node.rb', line 14599 def child_nodes [] end |
#compact_child_nodes ⇒ Array[node]
See Node.compact_child_nodes.
: () -> Array
14615 14616 14617 |
# File 'lib/prism/node.rb', line 14615 def compact_child_nodes [] end |
#copy(node_id: self.node_id, location: self.location, flags: self.flags, name: self.name) ⇒ GlobalVariableReadNode
:call-seq:
copy(**fields) -> GlobalVariableReadNode
Creates a copy of self with the given fields, using self as the template.
: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> GlobalVariableReadNode
14625 14626 14627 |
# File 'lib/prism/node.rb', line 14625 def copy(node_id: self.node_id, location: self.location, flags: self.flags, name: self.name) GlobalVariableReadNode.new(source, node_id, location, flags, name) end |
#deconstruct_keys(keys) ⇒ Hash[Symbol, untyped]
: (Array? keys) -> Hash[Symbol, untyped]
14632 14633 14634 14635 14636 14637 14638 14639 14640 14641 14642 |
# File 'lib/prism/node.rb', line 14632 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
14607 14608 14609 14610 |
# File 'lib/prism/node.rb', line 14607 def each_child_node(&blk) return to_enum(:each_child_node) unless block_given? end |
#inspect ⇒ String
: () -> String
14659 14660 14661 |
# File 'lib/prism/node.rb', line 14659 def inspect # :nodoc: InspectVisitor.compose(self) end |
#name ⇒ Symbol
:call-seq:
name -> Symbol
The name of the global variable, which is a $ followed by an identifier. Alternatively, it can be one of the special global variables designated by a symbol.
$foo # name `:$foo`
$_Test # name `:$_Test`
: () -> Symbol
14679 14680 14681 |
# File 'lib/prism/node.rb', line 14679 def name @name end |
#type ⇒ :global_variable_read_node
See Node#type.
: () -> :global_variable_read_node
14647 14648 14649 |
# File 'lib/prism/node.rb', line 14647 def type :global_variable_read_node end |