Class: YARP::InstanceVariableWriteNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::InstanceVariableWriteNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents writing to an instance variable.
@foo = 1
^^^^^^^^
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, value, operator_loc, location) ⇒ InstanceVariableWriteNode
constructor
def initialize: (name_loc: Location, value: Node?, operator_loc: Location?, location: Location) -> void.
-
#name ⇒ Object
def name: () -> String.
-
#operator ⇒ Object
def operator: () -> String?.
Constructor Details
#initialize(name_loc, value, operator_loc, location) ⇒ InstanceVariableWriteNode
def initialize: (name_loc: Location, value: Node?, operator_loc: Location?, location: Location) -> void
3289 3290 3291 3292 3293 3294 |
# File 'lib/yarp/node.rb', line 3289 def initialize(name_loc, value, operator_loc, location) @name_loc = name_loc @value = value @operator_loc = operator_loc @location = location end |
Instance Attribute Details
#name_loc ⇒ Object (readonly)
attr_reader name_loc: Location
3280 3281 3282 |
# File 'lib/yarp/node.rb', line 3280 def name_loc @name_loc end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location?
3286 3287 3288 |
# File 'lib/yarp/node.rb', line 3286 def operator_loc @operator_loc end |
#value ⇒ Object (readonly)
attr_reader value: Node?
3283 3284 3285 |
# File 'lib/yarp/node.rb', line 3283 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
3297 3298 3299 |
# File 'lib/yarp/node.rb', line 3297 def accept(visitor) visitor.visit_instance_variable_write_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
3302 3303 3304 |
# File 'lib/yarp/node.rb', line 3302 def child_nodes [value] end |
#deconstruct_keys(keys) ⇒ Object
3310 3311 3312 |
# File 'lib/yarp/node.rb', line 3310 def deconstruct_keys(keys) { name_loc: name_loc, value: value, operator_loc: operator_loc, location: location } end |
#name ⇒ Object
def name: () -> String
3315 3316 3317 |
# File 'lib/yarp/node.rb', line 3315 def name name_loc.slice end |
#operator ⇒ Object
def operator: () -> String?
3320 3321 3322 |
# File 'lib/yarp/node.rb', line 3320 def operator operator_loc&.slice end |