Class: YARP::WhenNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::WhenNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
case true when true ^^^^^^^^^ end
Instance Attribute Summary collapse
-
#conditions ⇒ Object
readonly
attr_reader conditions: Array.
-
#keyword_loc ⇒ Object
readonly
attr_reader keyword_loc: Location.
-
#statements ⇒ Object
readonly
attr_reader statements: 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(keyword_loc, conditions, statements, location) ⇒ WhenNode
constructor
def initialize: (keyword_loc: Location, conditions: Array, statements: Node?, location: Location) -> void.
-
#keyword ⇒ Object
def keyword: () -> String.
Constructor Details
#initialize(keyword_loc, conditions, statements, location) ⇒ WhenNode
def initialize: (keyword_loc: Location, conditions: Array, statements: Node?, location: Location) -> void
6189 6190 6191 6192 6193 6194 |
# File 'lib/yarp/node.rb', line 6189 def initialize(keyword_loc, conditions, statements, location) @keyword_loc = keyword_loc @conditions = conditions @statements = statements @location = location end |
Instance Attribute Details
#conditions ⇒ Object (readonly)
attr_reader conditions: Array
6183 6184 6185 |
# File 'lib/yarp/node.rb', line 6183 def conditions @conditions end |
#keyword_loc ⇒ Object (readonly)
attr_reader keyword_loc: Location
6180 6181 6182 |
# File 'lib/yarp/node.rb', line 6180 def keyword_loc @keyword_loc end |
#statements ⇒ Object (readonly)
attr_reader statements: Node?
6186 6187 6188 |
# File 'lib/yarp/node.rb', line 6186 def statements @statements end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
6197 6198 6199 |
# File 'lib/yarp/node.rb', line 6197 def accept(visitor) visitor.visit_when_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
6202 6203 6204 |
# File 'lib/yarp/node.rb', line 6202 def child_nodes [*conditions, statements] end |
#deconstruct_keys(keys) ⇒ Object
6210 6211 6212 |
# File 'lib/yarp/node.rb', line 6210 def deconstruct_keys(keys) { keyword_loc: keyword_loc, conditions: conditions, statements: statements, location: location } end |
#keyword ⇒ Object
def keyword: () -> String
6215 6216 6217 |
# File 'lib/yarp/node.rb', line 6215 def keyword keyword_loc.slice end |