Class: YARP::CallOperatorOrWriteNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::CallOperatorOrWriteNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents the use of the ‘||=` operator on a call.
foo.bar ||= value
^^^^^^^^^^^^^^^^^
Instance Attribute Summary collapse
-
#operator_loc ⇒ Object
readonly
attr_reader operator_loc: Location.
-
#target ⇒ Object
readonly
attr_reader target: Node.
-
#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(target, value, operator_loc, location) ⇒ CallOperatorOrWriteNode
constructor
def initialize: (target: Node, value: Node, operator_loc: Location, location: Location) -> void.
-
#operator ⇒ Object
def operator: () -> String.
Constructor Details
#initialize(target, value, operator_loc, location) ⇒ CallOperatorOrWriteNode
def initialize: (target: Node, value: Node, operator_loc: Location, location: Location) -> void
920 921 922 923 924 925 |
# File 'lib/yarp/node.rb', line 920 def initialize(target, value, operator_loc, location) @target = target @value = value @operator_loc = operator_loc @location = location end |
Instance Attribute Details
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location
917 918 919 |
# File 'lib/yarp/node.rb', line 917 def operator_loc @operator_loc end |
#target ⇒ Object (readonly)
attr_reader target: Node
911 912 913 |
# File 'lib/yarp/node.rb', line 911 def target @target end |
#value ⇒ Object (readonly)
attr_reader value: Node
914 915 916 |
# File 'lib/yarp/node.rb', line 914 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
928 929 930 |
# File 'lib/yarp/node.rb', line 928 def accept(visitor) visitor.visit_call_operator_or_write_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
934 935 936 |
# File 'lib/yarp/node.rb', line 934 def child_nodes [target, value] end |
#deconstruct_keys(keys) ⇒ Object
942 943 944 |
# File 'lib/yarp/node.rb', line 942 def deconstruct_keys(keys) { target: target, value: value, operator_loc: operator_loc, location: location } end |
#operator ⇒ Object
def operator: () -> String
947 948 949 |
# File 'lib/yarp/node.rb', line 947 def operator operator_loc.slice end |