Class: YARP::RangeNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::RangeNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents the use of the ‘..` or `…` operators.
1..2
^^^^
c if a =~ /left/ ... b =~ /right/
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Instance Attribute Summary collapse
-
#flags ⇒ Object
readonly
attr_reader flags: Integer.
-
#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, flags, location) ⇒ RangeNode
constructor
def initialize: (left: Node?, right: Node?, operator_loc: Location, flags: Integer, location: Location) -> void.
-
#operator ⇒ Object
def operator: () -> String.
Constructor Details
#initialize(left, right, operator_loc, flags, location) ⇒ RangeNode
def initialize: (left: Node?, right: Node?, operator_loc: Location, flags: Integer, location: Location) -> void
4936 4937 4938 4939 4940 4941 4942 |
# File 'lib/yarp/node.rb', line 4936 def initialize(left, right, operator_loc, flags, location) @left = left @right = right @operator_loc = operator_loc @flags = flags @location = location end |
Instance Attribute Details
#flags ⇒ Object (readonly)
attr_reader flags: Integer
4933 4934 4935 |
# File 'lib/yarp/node.rb', line 4933 def flags @flags end |
#left ⇒ Object (readonly)
attr_reader left: Node?
4924 4925 4926 |
# File 'lib/yarp/node.rb', line 4924 def left @left end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location
4930 4931 4932 |
# File 'lib/yarp/node.rb', line 4930 def operator_loc @operator_loc end |
#right ⇒ Object (readonly)
attr_reader right: Node?
4927 4928 4929 |
# File 'lib/yarp/node.rb', line 4927 def right @right end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
4945 4946 4947 |
# File 'lib/yarp/node.rb', line 4945 def accept(visitor) visitor.visit_range_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
4951 4952 4953 |
# File 'lib/yarp/node.rb', line 4951 def child_nodes [left, right] end |
#deconstruct_keys(keys) ⇒ Object
4959 4960 4961 |
# File 'lib/yarp/node.rb', line 4959 def deconstruct_keys(keys) { left: left, right: right, operator_loc: operator_loc, flags: flags, location: location } end |
#operator ⇒ Object
def operator: () -> String
4964 4965 4966 |
# File 'lib/yarp/node.rb', line 4964 def operator operator_loc.slice end |