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
914 915 916 917 918 919 |
# File 'lib/yarp/node.rb', line 914 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
911 912 913 |
# File 'lib/yarp/node.rb', line 911 def operator_loc @operator_loc end |
#target ⇒ Object (readonly)
attr_reader target: Node
905 906 907 |
# File 'lib/yarp/node.rb', line 905 def target @target end |
#value ⇒ Object (readonly)
attr_reader value: Node
908 909 910 |
# File 'lib/yarp/node.rb', line 908 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
922 923 924 |
# File 'lib/yarp/node.rb', line 922 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]
927 928 929 |
# File 'lib/yarp/node.rb', line 927 def child_nodes [target, value] end |
#deconstruct_keys(keys) ⇒ Object
935 936 937 |
# File 'lib/yarp/node.rb', line 935 def deconstruct_keys(keys) { target: target, value: value, operator_loc: operator_loc, location: location } end |
#operator ⇒ Object
def operator: () -> String
940 941 942 |
# File 'lib/yarp/node.rb', line 940 def operator operator_loc.slice end |