Class: YARP::GlobalVariableTargetNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::GlobalVariableTargetNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents writing to a global variable in a context that doesn’t have an explicit value.
$foo, $bar = baz
^^^^ ^^^^
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
attr_reader name: Symbol.
Instance Method Summary collapse
-
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void.
-
#child_nodes ⇒ Object
(also: #deconstruct)
def child_nodes: () -> Array[nil | Node].
-
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location].
-
#copy(**params) ⇒ Object
def copy: (**params) -> GlobalVariableTargetNode.
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(name, location) ⇒ GlobalVariableTargetNode
constructor
def initialize: (name: Symbol, location: Location) -> void.
- #inspect(inspector = NodeInspector.new) ⇒ Object
Constructor Details
#initialize(name, location) ⇒ GlobalVariableTargetNode
def initialize: (name: Symbol, location: Location) -> void
4795 4796 4797 4798 |
# File 'lib/yarp/node.rb', line 4795 def initialize(name, location) @name = name @location = location end |
Instance Attribute Details
#name ⇒ Object (readonly)
attr_reader name: Symbol
4792 4793 4794 |
# File 'lib/yarp/node.rb', line 4792 def name @name end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
4801 4802 4803 |
# File 'lib/yarp/node.rb', line 4801 def accept(visitor) visitor.visit_global_variable_target_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
4806 4807 4808 |
# File 'lib/yarp/node.rb', line 4806 def child_nodes [] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
4811 4812 4813 |
# File 'lib/yarp/node.rb', line 4811 def comment_targets [] end |
#copy(**params) ⇒ Object
def copy: (**params) -> GlobalVariableTargetNode
4816 4817 4818 4819 4820 4821 |
# File 'lib/yarp/node.rb', line 4816 def copy(**params) GlobalVariableTargetNode.new( params.fetch(:name) { name }, params.fetch(:location) { location }, ) end |
#deconstruct_keys(keys) ⇒ Object
4827 4828 4829 |
# File 'lib/yarp/node.rb', line 4827 def deconstruct_keys(keys) { name: name, location: location } end |
#inspect(inspector = NodeInspector.new) ⇒ Object
4831 4832 4833 4834 4835 |
# File 'lib/yarp/node.rb', line 4831 def inspect(inspector = NodeInspector.new) inspector << inspector.header(self) inspector << "└── name: #{name.inspect}\n" inspector.to_str end |