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
118 119 120 121 122 123 |
# File 'lib/yarp/node.rb', line 118 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
109 110 111 |
# File 'lib/yarp/node.rb', line 109 def left @left end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location
115 116 117 |
# File 'lib/yarp/node.rb', line 115 def operator_loc @operator_loc end |
#right ⇒ Object (readonly)
attr_reader right: Node
112 113 114 |
# File 'lib/yarp/node.rb', line 112 def right @right end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
126 127 128 |
# File 'lib/yarp/node.rb', line 126 def accept(visitor) visitor.visit_and_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
132 133 134 |
# File 'lib/yarp/node.rb', line 132 def child_nodes [left, right] end |
#deconstruct_keys(keys) ⇒ Object
140 141 142 |
# File 'lib/yarp/node.rb', line 140 def deconstruct_keys(keys) { left: left, right: right, operator_loc: operator_loc, location: location } end |
#operator ⇒ Object
def operator: () -> String
145 146 147 |
# File 'lib/yarp/node.rb', line 145 def operator operator_loc.slice end |