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
5114 5115 5116 5117 5118 5119 |
# File 'lib/yarp/node.rb', line 5114 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
5111 5112 5113 |
# File 'lib/yarp/node.rb', line 5111 def closing_loc @closing_loc end |
#opening_loc ⇒ Object (readonly)
attr_reader opening_loc: Location
5108 5109 5110 |
# File 'lib/yarp/node.rb', line 5108 def opening_loc @opening_loc end |
#parameters ⇒ Object (readonly)
attr_reader parameters: Array
5105 5106 5107 |
# File 'lib/yarp/node.rb', line 5105 def parameters @parameters end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
5122 5123 5124 |
# File 'lib/yarp/node.rb', line 5122 def accept(visitor) visitor.visit_required_destructured_parameter_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
5128 5129 5130 |
# File 'lib/yarp/node.rb', line 5128 def child_nodes [*parameters] end |
#closing ⇒ Object
def closing: () -> String
5146 5147 5148 |
# File 'lib/yarp/node.rb', line 5146 def closing closing_loc.slice end |
#deconstruct_keys(keys) ⇒ Object
5136 5137 5138 |
# File 'lib/yarp/node.rb', line 5136 def deconstruct_keys(keys) { parameters: parameters, opening_loc: opening_loc, closing_loc: closing_loc, location: location } end |
#opening ⇒ Object
def opening: () -> String
5141 5142 5143 |
# File 'lib/yarp/node.rb', line 5141 def opening opening_loc.slice end |