Class: YARP::LocalVariableOperatorOrWriteNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::LocalVariableOperatorOrWriteNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents the use of the ‘||=` operator for assignment to a local variable.
target ||= value
^^^^^^^^^^^^^^^^
Instance Attribute Summary collapse
-
#constant_id ⇒ Object
readonly
attr_reader constant_id: Symbol.
-
#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, constant_id, location) ⇒ LocalVariableOperatorOrWriteNode
constructor
def initialize: (name_loc: Location, operator_loc: Location, value: Node, constant_id: Symbol, location: Location) -> void.
-
#name ⇒ Object
def name: () -> String.
-
#operator ⇒ Object
def operator: () -> String.
Constructor Details
#initialize(name_loc, operator_loc, value, constant_id, location) ⇒ LocalVariableOperatorOrWriteNode
def initialize: (name_loc: Location, operator_loc: Location, value: Node, constant_id: Symbol, location: Location) -> void
3837 3838 3839 3840 3841 3842 3843 |
# File 'lib/yarp/node.rb', line 3837 def initialize(name_loc, operator_loc, value, constant_id, location) @name_loc = name_loc @operator_loc = operator_loc @value = value @constant_id = constant_id @location = location end |
Instance Attribute Details
#constant_id ⇒ Object (readonly)
attr_reader constant_id: Symbol
3834 3835 3836 |
# File 'lib/yarp/node.rb', line 3834 def constant_id @constant_id end |
#name_loc ⇒ Object (readonly)
attr_reader name_loc: Location
3825 3826 3827 |
# File 'lib/yarp/node.rb', line 3825 def name_loc @name_loc end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location
3828 3829 3830 |
# File 'lib/yarp/node.rb', line 3828 def operator_loc @operator_loc end |
#value ⇒ Object (readonly)
attr_reader value: Node
3831 3832 3833 |
# File 'lib/yarp/node.rb', line 3831 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
3846 3847 3848 |
# File 'lib/yarp/node.rb', line 3846 def accept(visitor) visitor.visit_local_variable_operator_or_write_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
3852 3853 3854 |
# File 'lib/yarp/node.rb', line 3852 def child_nodes [value] end |
#deconstruct_keys(keys) ⇒ Object
3860 3861 3862 |
# File 'lib/yarp/node.rb', line 3860 def deconstruct_keys(keys) { name_loc: name_loc, operator_loc: operator_loc, value: value, constant_id: constant_id, location: location } end |
#name ⇒ Object
def name: () -> String
3865 3866 3867 |
# File 'lib/yarp/node.rb', line 3865 def name name_loc.slice end |
#operator ⇒ Object
def operator: () -> String
3870 3871 3872 |
# File 'lib/yarp/node.rb', line 3870 def operator operator_loc.slice end |