Class: YARP::AndNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::AndNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents the use of the ‘&&` operator or the `and` keyword.
left and right
^^^^^^^^^^^^^^
Instance Attribute Summary collapse
-
#left ⇒ Object
readonly
attr_reader left: Node.
-
#operator_loc ⇒ Object
readonly
attr_reader operator_loc: Location.
-
#right ⇒ Object
readonly
attr_reader right: 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(left, right, operator_loc, location) ⇒ AndNode
constructor
def initialize: (left: Node, right: Node, operator_loc: Location, location: Location) -> void.
-
#operator ⇒ Object
def operator: () -> String.
Constructor Details
#initialize(left, right, operator_loc, location) ⇒ AndNode
def initialize: (left: Node, right: Node, operator_loc: Location, location: Location) -> void
116 117 118 119 120 121 |
# File 'lib/yarp/node.rb', line 116 def initialize(left, right, operator_loc, location) @left = left @right = right @operator_loc = operator_loc @location = location end |
Instance Attribute Details
#left ⇒ Object (readonly)
attr_reader left: Node
107 108 109 |
# File 'lib/yarp/node.rb', line 107 def left @left end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location
113 114 115 |
# File 'lib/yarp/node.rb', line 113 def operator_loc @operator_loc end |
#right ⇒ Object (readonly)
attr_reader right: Node
110 111 112 |
# File 'lib/yarp/node.rb', line 110 def right @right end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
124 125 126 |
# File 'lib/yarp/node.rb', line 124 def accept(visitor) visitor.visit_and_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
129 130 131 |
# File 'lib/yarp/node.rb', line 129 def child_nodes [left, right] end |
#deconstruct_keys(keys) ⇒ Object
137 138 139 |
# File 'lib/yarp/node.rb', line 137 def deconstruct_keys(keys) { left: left, right: right, operator_loc: operator_loc, location: location } end |
#operator ⇒ Object
def operator: () -> String
142 143 144 |
# File 'lib/yarp/node.rb', line 142 def operator operator_loc.slice end |