Class: YARP::InstanceVariableOperatorOrWriteNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::InstanceVariableOperatorOrWriteNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents the use of the ‘||=` operator for assignment to an instance 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) ⇒ InstanceVariableOperatorOrWriteNode
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) ⇒ InstanceVariableOperatorOrWriteNode
def initialize: (name_loc: Location, operator_loc: Location, value: Node, location: Location) -> void
3153 3154 3155 3156 3157 3158 |
# File 'lib/yarp/node.rb', line 3153 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
3144 3145 3146 |
# File 'lib/yarp/node.rb', line 3144 def name_loc @name_loc end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location
3147 3148 3149 |
# File 'lib/yarp/node.rb', line 3147 def operator_loc @operator_loc end |
#value ⇒ Object (readonly)
attr_reader value: Node
3150 3151 3152 |
# File 'lib/yarp/node.rb', line 3150 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
3161 3162 3163 |
# File 'lib/yarp/node.rb', line 3161 def accept(visitor) visitor.visit_instance_variable_operator_or_write_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
3167 3168 3169 |
# File 'lib/yarp/node.rb', line 3167 def child_nodes [value] end |
#deconstruct_keys(keys) ⇒ Object
3175 3176 3177 |
# File 'lib/yarp/node.rb', line 3175 def deconstruct_keys(keys) { name_loc: name_loc, operator_loc: operator_loc, value: value, location: location } end |
#name ⇒ Object
def name: () -> String
3180 3181 3182 |
# File 'lib/yarp/node.rb', line 3180 def name name_loc.slice end |
#operator ⇒ Object
def operator: () -> String
3185 3186 3187 |
# File 'lib/yarp/node.rb', line 3185 def operator operator_loc.slice end |