Class: YARP::GlobalVariableOperatorOrWriteNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::GlobalVariableOperatorOrWriteNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents the use of the ‘||=` operator for assignment to a global variable.
$target ||= value
^^^^^^^^^^^^^^^^^
Instance Attribute Summary collapse
-
#name_loc ⇒ Object
readonly
attr_reader name_loc: Location.
-
#operator_loc ⇒ Object
readonly
attr_reader operator_loc: Location.
-
#value ⇒ Object
readonly
attr_reader value: Node.
Instance Method Summary collapse
-
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void.
-
#child_nodes ⇒ Object
(also: #deconstruct)
def child_nodes: () -> Array[nil | Node].
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(name_loc, operator_loc, value, location) ⇒ GlobalVariableOperatorOrWriteNode
constructor
def initialize: (name_loc: Location, operator_loc: Location, value: Node, location: Location) -> void.
-
#name ⇒ Object
def name: () -> String.
-
#operator ⇒ Object
def operator: () -> String.
Constructor Details
#initialize(name_loc, operator_loc, value, location) ⇒ GlobalVariableOperatorOrWriteNode
def initialize: (name_loc: Location, operator_loc: Location, value: Node, location: Location) -> void
2660 2661 2662 2663 2664 2665 |
# File 'lib/yarp/node.rb', line 2660 def initialize(name_loc, operator_loc, value, location) @name_loc = name_loc @operator_loc = operator_loc @value = value @location = location end |
Instance Attribute Details
#name_loc ⇒ Object (readonly)
attr_reader name_loc: Location
2651 2652 2653 |
# File 'lib/yarp/node.rb', line 2651 def name_loc @name_loc end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location
2654 2655 2656 |
# File 'lib/yarp/node.rb', line 2654 def operator_loc @operator_loc end |
#value ⇒ Object (readonly)
attr_reader value: Node
2657 2658 2659 |
# File 'lib/yarp/node.rb', line 2657 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
2668 2669 2670 |
# File 'lib/yarp/node.rb', line 2668 def accept(visitor) visitor.visit_global_variable_operator_or_write_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
2673 2674 2675 |
# File 'lib/yarp/node.rb', line 2673 def child_nodes [value] end |
#deconstruct_keys(keys) ⇒ Object
2681 2682 2683 |
# File 'lib/yarp/node.rb', line 2681 def deconstruct_keys(keys) { name_loc: name_loc, operator_loc: operator_loc, value: value, location: location } end |
#name ⇒ Object
def name: () -> String
2686 2687 2688 |
# File 'lib/yarp/node.rb', line 2686 def name name_loc.slice end |
#operator ⇒ Object
def operator: () -> String
2691 2692 2693 |
# File 'lib/yarp/node.rb', line 2691 def operator operator_loc.slice end |