Class: YARP::OrNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::OrNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents the use of the ‘||` operator or the `or` keyword.
left or 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) ⇒ OrNode
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) ⇒ OrNode
def initialize: (left: Node, right: Node, operator_loc: Location, location: Location) -> void
4506 4507 4508 4509 4510 4511 |
# File 'lib/yarp/node.rb', line 4506 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
4497 4498 4499 |
# File 'lib/yarp/node.rb', line 4497 def left @left end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location
4503 4504 4505 |
# File 'lib/yarp/node.rb', line 4503 def operator_loc @operator_loc end |
#right ⇒ Object (readonly)
attr_reader right: Node
4500 4501 4502 |
# File 'lib/yarp/node.rb', line 4500 def right @right end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
4514 4515 4516 |
# File 'lib/yarp/node.rb', line 4514 def accept(visitor) visitor.visit_or_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
4520 4521 4522 |
# File 'lib/yarp/node.rb', line 4520 def child_nodes [left, right] end |
#deconstruct_keys(keys) ⇒ Object
4528 4529 4530 |
# File 'lib/yarp/node.rb', line 4528 def deconstruct_keys(keys) { left: left, right: right, operator_loc: operator_loc, location: location } end |
#operator ⇒ Object
def operator: () -> String
4533 4534 4535 |
# File 'lib/yarp/node.rb', line 4533 def operator operator_loc.slice end |