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
-
#exclude_end? ⇒ Boolean
def exclude_end?: () -> bool.
-
#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
4951 4952 4953 4954 4955 4956 4957 |
# File 'lib/yarp/node.rb', line 4951 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
4948 4949 4950 |
# File 'lib/yarp/node.rb', line 4948 def flags @flags end |
#left ⇒ Object (readonly)
attr_reader left: Node?
4939 4940 4941 |
# File 'lib/yarp/node.rb', line 4939 def left @left end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location
4945 4946 4947 |
# File 'lib/yarp/node.rb', line 4945 def operator_loc @operator_loc end |
#right ⇒ Object (readonly)
attr_reader right: Node?
4942 4943 4944 |
# File 'lib/yarp/node.rb', line 4942 def right @right end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
4960 4961 4962 |
# File 'lib/yarp/node.rb', line 4960 def accept(visitor) visitor.visit_range_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
4965 4966 4967 |
# File 'lib/yarp/node.rb', line 4965 def child_nodes [left, right] end |
#deconstruct_keys(keys) ⇒ Object
4973 4974 4975 |
# File 'lib/yarp/node.rb', line 4973 def deconstruct_keys(keys) { left: left, right: right, operator_loc: operator_loc, flags: flags, location: location } end |
#exclude_end? ⇒ Boolean
def exclude_end?: () -> bool
4983 4984 4985 |
# File 'lib/yarp/node.rb', line 4983 def exclude_end? flags.anybits?(RangeFlags::EXCLUDE_END) end |
#operator ⇒ Object
def operator: () -> String
4978 4979 4980 |
# File 'lib/yarp/node.rb', line 4978 def operator operator_loc.slice end |