Class: YARP::GlobalVariableReadNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::GlobalVariableReadNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents referencing a global variable.
$foo
^^^^
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) -> GlobalVariableReadNode.
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(name, location) ⇒ GlobalVariableReadNode
constructor
def initialize: (name: Symbol, location: Location) -> void.
- #inspect(inspector = NodeInspector.new) ⇒ Object
Constructor Details
#initialize(name, location) ⇒ GlobalVariableReadNode
def initialize: (name: Symbol, location: Location) -> void
4743 4744 4745 4746 |
# File 'lib/yarp/node.rb', line 4743 def initialize(name, location) @name = name @location = location end |
Instance Attribute Details
#name ⇒ Object (readonly)
attr_reader name: Symbol
4740 4741 4742 |
# File 'lib/yarp/node.rb', line 4740 def name @name end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
4749 4750 4751 |
# File 'lib/yarp/node.rb', line 4749 def accept(visitor) visitor.visit_global_variable_read_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
4754 4755 4756 |
# File 'lib/yarp/node.rb', line 4754 def child_nodes [] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
4759 4760 4761 |
# File 'lib/yarp/node.rb', line 4759 def comment_targets [] end |
#copy(**params) ⇒ Object
def copy: (**params) -> GlobalVariableReadNode
4764 4765 4766 4767 4768 4769 |
# File 'lib/yarp/node.rb', line 4764 def copy(**params) GlobalVariableReadNode.new( params.fetch(:name) { name }, params.fetch(:location) { location }, ) end |
#deconstruct_keys(keys) ⇒ Object
4775 4776 4777 |
# File 'lib/yarp/node.rb', line 4775 def deconstruct_keys(keys) { name: name, location: location } end |
#inspect(inspector = NodeInspector.new) ⇒ Object
4779 4780 4781 4782 4783 |
# File 'lib/yarp/node.rb', line 4779 def inspect(inspector = NodeInspector.new) inspector << inspector.header(self) inspector << "└── name: #{name.inspect}\n" inspector.to_str end |