Class: Prism::GlobalVariableTargetNode
- Inherits:
-
PrismNode
- Object
- PrismNode
- Prism::GlobalVariableTargetNode
- Defined in:
- lib/prism/node.rb,
sig/generated/prism/node.rbs,
ext/prism/api_node.c
Overview
Represents writing to a global variable in a context that doesn't have an explicit value.
$foo, $bar = baz
^^^^ ^^^^
Class Method Summary collapse
-
.type ⇒ :global_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) ⇒ GlobalVariableTargetNode
:call-seq: copy(**fields) -> GlobalVariableTargetNode.
-
#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) ⇒ GlobalVariableTargetNode
constructor
Initialize a new GlobalVariableTargetNode node.
-
#inspect ⇒ String
: () -> String.
-
#name ⇒ Symbol
:call-seq: name -> Symbol.
-
#type ⇒ :global_variable_target_node
See
Node#type.
Constructor Details
#initialize(source, node_id, location, flags, name) ⇒ GlobalVariableTargetNode
Initialize a new GlobalVariableTargetNode node.
: (Source source, Integer node_id, Location location, Integer flags, Symbol name) -> void
14708 14709 14710 14711 14712 14713 14714 |
# File 'lib/prism/node.rb', line 14708 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_target_node
See Node.type.
: () -> :global_variable_target_node
14792 14793 14794 |
# File 'lib/prism/node.rb', line 14792 def self.type :global_variable_target_node end |
Instance Method Details
#===(other) ⇒ boolish
: (untyped other) -> boolish
14818 14819 14820 14821 |
# File 'lib/prism/node.rb', line 14818 def ===(other) # :nodoc: other.is_a?(GlobalVariableTargetNode) && (name === other.name) end |
#accept(visitor) ⇒ Object
See Node.accept.
: (_Visitor visitor) -> untyped
14730 14731 14732 |
# File 'lib/prism/node.rb', line 14730 def accept(visitor) visitor.visit_global_variable_target_node(self) end |
#child_nodes ⇒ Array[node?] Also known as: deconstruct
See Node.child_nodes.
: () -> Array
14737 14738 14739 |
# File 'lib/prism/node.rb', line 14737 def child_nodes [] end |
#compact_child_nodes ⇒ Array[node]
See Node.compact_child_nodes.
: () -> Array
14753 14754 14755 |
# File 'lib/prism/node.rb', line 14753 def compact_child_nodes [] end |
#copy(node_id: self.node_id, location: self.location, flags: self.flags, name: self.name) ⇒ GlobalVariableTargetNode
:call-seq:
copy(**fields) -> GlobalVariableTargetNode
Creates a copy of self with the given fields, using self as the template.
: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> GlobalVariableTargetNode
14763 14764 14765 |
# File 'lib/prism/node.rb', line 14763 def copy(node_id: self.node_id, location: self.location, flags: self.flags, name: self.name) GlobalVariableTargetNode.new(source, node_id, location, flags, name) end |
#deconstruct_keys(keys) ⇒ Hash[Symbol, untyped]
: (Array? keys) -> Hash[Symbol, untyped]
14770 14771 14772 14773 14774 14775 14776 14777 14778 14779 14780 |
# File 'lib/prism/node.rb', line 14770 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
14745 14746 14747 14748 |
# File 'lib/prism/node.rb', line 14745 def each_child_node(&blk) return to_enum(:each_child_node) unless block_given? end |
#inspect ⇒ String
: () -> String
14797 14798 14799 |
# File 'lib/prism/node.rb', line 14797 def inspect # :nodoc: InspectVisitor.compose(self) end |
#name ⇒ Symbol
:call-seq:
name -> Symbol
Returns the name attribute.
: () -> Symbol
14809 14810 14811 |
# File 'lib/prism/node.rb', line 14809 def name @name end |
#type ⇒ :global_variable_target_node
See Node#type.
: () -> :global_variable_target_node
14785 14786 14787 |
# File 'lib/prism/node.rb', line 14785 def type :global_variable_target_node end |