Class: YARP::RequiredDestructuredParameterNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::RequiredDestructuredParameterNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents a destructured required parameter node.
def foo((bar, baz))
^^^^^^^^^^
end
Instance Attribute Summary collapse
-
#closing_loc ⇒ Object
readonly
attr_reader closing_loc: Location.
-
#opening_loc ⇒ Object
readonly
attr_reader opening_loc: Location.
-
#parameters ⇒ Object
readonly
attr_reader parameters: Array.
Instance Method Summary collapse
-
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void.
-
#child_nodes ⇒ Object
(also: #deconstruct)
def child_nodes: () -> Array[nil | Node].
-
#closing ⇒ Object
def closing: () -> String.
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(parameters, opening_loc, closing_loc, location) ⇒ RequiredDestructuredParameterNode
constructor
def initialize: (parameters: Array, opening_loc: Location, closing_loc: Location, location: Location) -> void.
-
#opening ⇒ Object
def opening: () -> String.
Constructor Details
#initialize(parameters, opening_loc, closing_loc, location) ⇒ RequiredDestructuredParameterNode
def initialize: (parameters: Array, opening_loc: Location, closing_loc: Location, location: Location) -> void
5170 5171 5172 5173 5174 5175 |
# File 'lib/yarp/node.rb', line 5170 def initialize(parameters, opening_loc, closing_loc, location) @parameters = parameters @opening_loc = opening_loc @closing_loc = closing_loc @location = location end |
Instance Attribute Details
#closing_loc ⇒ Object (readonly)
attr_reader closing_loc: Location
5167 5168 5169 |
# File 'lib/yarp/node.rb', line 5167 def closing_loc @closing_loc end |
#opening_loc ⇒ Object (readonly)
attr_reader opening_loc: Location
5164 5165 5166 |
# File 'lib/yarp/node.rb', line 5164 def opening_loc @opening_loc end |
#parameters ⇒ Object (readonly)
attr_reader parameters: Array
5161 5162 5163 |
# File 'lib/yarp/node.rb', line 5161 def parameters @parameters end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
5178 5179 5180 |
# File 'lib/yarp/node.rb', line 5178 def accept(visitor) visitor.visit_required_destructured_parameter_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
5183 5184 5185 |
# File 'lib/yarp/node.rb', line 5183 def child_nodes [*parameters] end |
#closing ⇒ Object
def closing: () -> String
5201 5202 5203 |
# File 'lib/yarp/node.rb', line 5201 def closing closing_loc.slice end |
#deconstruct_keys(keys) ⇒ Object
5191 5192 5193 |
# File 'lib/yarp/node.rb', line 5191 def deconstruct_keys(keys) { parameters: parameters, opening_loc: opening_loc, closing_loc: closing_loc, location: location } end |
#opening ⇒ Object
def opening: () -> String
5196 5197 5198 |
# File 'lib/yarp/node.rb', line 5196 def opening opening_loc.slice end |