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
6147 6148 6149 6150 6151 6152 |
# File 'lib/yarp/node.rb', line 6147 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
6141 6142 6143 |
# File 'lib/yarp/node.rb', line 6141 def conditions @conditions end |
#keyword_loc ⇒ Object (readonly)
attr_reader keyword_loc: Location
6138 6139 6140 |
# File 'lib/yarp/node.rb', line 6138 def keyword_loc @keyword_loc end |
#statements ⇒ Object (readonly)
attr_reader statements: Node?
6144 6145 6146 |
# File 'lib/yarp/node.rb', line 6144 def statements @statements end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
6155 6156 6157 |
# File 'lib/yarp/node.rb', line 6155 def accept(visitor) visitor.visit_when_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
6161 6162 6163 |
# File 'lib/yarp/node.rb', line 6161 def child_nodes [*conditions, statements] end |
#deconstruct_keys(keys) ⇒ Object
6169 6170 6171 |
# File 'lib/yarp/node.rb', line 6169 def deconstruct_keys(keys) { keyword_loc: keyword_loc, conditions: conditions, statements: statements, location: location } end |
#keyword ⇒ Object
def keyword: () -> String
6174 6175 6176 |
# File 'lib/yarp/node.rb', line 6174 def keyword keyword_loc.slice end |