Class: YARP::KeywordRestParameterNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::KeywordRestParameterNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents a keyword rest parameter to a method, block, or lambda definition.
def a(**b)
^^^
end
Instance Attribute Summary collapse
-
#name_loc ⇒ Object
readonly
attr_reader name_loc: Location?.
-
#operator_loc ⇒ Object
readonly
attr_reader operator_loc: Location.
Instance Method Summary collapse
-
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void.
-
#child_nodes ⇒ Object
(also: #deconstruct)
def child_nodes: () -> Array[nil | Node].
-
#copy(**params) ⇒ Object
def copy: (**params) -> KeywordRestParameterNode.
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(operator_loc, name_loc, location) ⇒ KeywordRestParameterNode
constructor
def initialize: (operator_loc: Location, name_loc: Location?, location: Location) -> void.
-
#name ⇒ Object
def name: () -> String?.
-
#operator ⇒ Object
def operator: () -> String.
Constructor Details
#initialize(operator_loc, name_loc, location) ⇒ KeywordRestParameterNode
def initialize: (operator_loc: Location, name_loc: Location?, location: Location) -> void
4671 4672 4673 4674 4675 |
# File 'lib/yarp/node.rb', line 4671 def initialize(operator_loc, name_loc, location) @operator_loc = operator_loc @name_loc = name_loc @location = location end |
Instance Attribute Details
#name_loc ⇒ Object (readonly)
attr_reader name_loc: Location?
4668 4669 4670 |
# File 'lib/yarp/node.rb', line 4668 def name_loc @name_loc end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location
4665 4666 4667 |
# File 'lib/yarp/node.rb', line 4665 def operator_loc @operator_loc end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
4678 4679 4680 |
# File 'lib/yarp/node.rb', line 4678 def accept(visitor) visitor.visit_keyword_rest_parameter_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
4683 4684 4685 |
# File 'lib/yarp/node.rb', line 4683 def child_nodes [] end |
#copy(**params) ⇒ Object
def copy: (**params) -> KeywordRestParameterNode
4688 4689 4690 4691 4692 4693 4694 |
# File 'lib/yarp/node.rb', line 4688 def copy(**params) KeywordRestParameterNode.new( params.fetch(:operator_loc) { operator_loc }, params.fetch(:name_loc) { name_loc }, params.fetch(:location) { location }, ) end |
#deconstruct_keys(keys) ⇒ Object
4700 4701 4702 |
# File 'lib/yarp/node.rb', line 4700 def deconstruct_keys(keys) { operator_loc: operator_loc, name_loc: name_loc, location: location } end |
#name ⇒ Object
def name: () -> String?
4710 4711 4712 |
# File 'lib/yarp/node.rb', line 4710 def name name_loc&.slice end |
#operator ⇒ Object
def operator: () -> String
4705 4706 4707 |
# File 'lib/yarp/node.rb', line 4705 def operator operator_loc.slice end |