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.
-
#copy(**params) ⇒ Object
def copy: (**params) -> RequiredDestructuredParameterNode.
- #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
6479 6480 6481 6482 6483 6484 |
# File 'lib/yarp/node.rb', line 6479 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
6476 6477 6478 |
# File 'lib/yarp/node.rb', line 6476 def closing_loc @closing_loc end |
#opening_loc ⇒ Object (readonly)
attr_reader opening_loc: Location
6473 6474 6475 |
# File 'lib/yarp/node.rb', line 6473 def opening_loc @opening_loc end |
#parameters ⇒ Object (readonly)
attr_reader parameters: Array
6470 6471 6472 |
# File 'lib/yarp/node.rb', line 6470 def parameters @parameters end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
6487 6488 6489 |
# File 'lib/yarp/node.rb', line 6487 def accept(visitor) visitor.visit_required_destructured_parameter_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
6492 6493 6494 |
# File 'lib/yarp/node.rb', line 6492 def child_nodes [*parameters] end |
#closing ⇒ Object
def closing: () -> String
6520 6521 6522 |
# File 'lib/yarp/node.rb', line 6520 def closing closing_loc.slice end |
#copy(**params) ⇒ Object
def copy: (**params) -> RequiredDestructuredParameterNode
6497 6498 6499 6500 6501 6502 6503 6504 |
# File 'lib/yarp/node.rb', line 6497 def copy(**params) RequiredDestructuredParameterNode.new( params.fetch(:parameters) { parameters }, params.fetch(:opening_loc) { opening_loc }, params.fetch(:closing_loc) { closing_loc }, params.fetch(:location) { location }, ) end |
#deconstruct_keys(keys) ⇒ Object
6510 6511 6512 |
# File 'lib/yarp/node.rb', line 6510 def deconstruct_keys(keys) { parameters: parameters, opening_loc: opening_loc, closing_loc: closing_loc, location: location } end |
#opening ⇒ Object
def opening: () -> String
6515 6516 6517 |
# File 'lib/yarp/node.rb', line 6515 def opening opening_loc.slice end |