Class: YARP::FlipFlopNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::FlipFlopNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents the use of the ‘..` or `…` operators to create flip flops.
baz if foo .. bar
^^^^^^^^^^
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) ⇒ FlipFlopNode
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) ⇒ FlipFlopNode
def initialize: (left: Node?, right: Node?, operator_loc: Location, flags: Integer, location: Location) -> void
2357 2358 2359 2360 2361 2362 2363 |
# File 'lib/yarp/node.rb', line 2357 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
2354 2355 2356 |
# File 'lib/yarp/node.rb', line 2354 def flags @flags end |
#left ⇒ Object (readonly)
attr_reader left: Node?
2345 2346 2347 |
# File 'lib/yarp/node.rb', line 2345 def left @left end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location
2351 2352 2353 |
# File 'lib/yarp/node.rb', line 2351 def operator_loc @operator_loc end |
#right ⇒ Object (readonly)
attr_reader right: Node?
2348 2349 2350 |
# File 'lib/yarp/node.rb', line 2348 def right @right end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
2366 2367 2368 |
# File 'lib/yarp/node.rb', line 2366 def accept(visitor) visitor.visit_flip_flop_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
2371 2372 2373 |
# File 'lib/yarp/node.rb', line 2371 def child_nodes [left, right] end |
#deconstruct_keys(keys) ⇒ Object
2379 2380 2381 |
# File 'lib/yarp/node.rb', line 2379 def deconstruct_keys(keys) { left: left, right: right, operator_loc: operator_loc, flags: flags, location: location } end |
#exclude_end? ⇒ Boolean
def exclude_end?: () -> bool
2389 2390 2391 |
# File 'lib/yarp/node.rb', line 2389 def exclude_end? flags.anybits?(RangeFlags::EXCLUDE_END) end |
#operator ⇒ Object
def operator: () -> String
2384 2385 2386 |
# File 'lib/yarp/node.rb', line 2384 def operator operator_loc.slice end |