Class: YARP::KeywordRestParameterNode

Inherits:
YARPNode
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(operator_loc, name_loc, location) ⇒ KeywordRestParameterNode

def initialize: (operator_loc: Location, name_loc: Location?, location: Location) -> void



3676
3677
3678
3679
3680
# File 'lib/yarp/node.rb', line 3676

def initialize(operator_loc, name_loc, location)
  @operator_loc = operator_loc
  @name_loc = name_loc
  @location = location
end

Instance Attribute Details

#name_locObject (readonly)

attr_reader name_loc: Location?



3673
3674
3675
# File 'lib/yarp/node.rb', line 3673

def name_loc
  @name_loc
end

#operator_locObject (readonly)

attr_reader operator_loc: Location



3670
3671
3672
# File 'lib/yarp/node.rb', line 3670

def operator_loc
  @operator_loc
end

Instance Method Details

#accept(visitor) ⇒ Object

def accept: (visitor: Visitor) -> void



3683
3684
3685
# File 'lib/yarp/node.rb', line 3683

def accept(visitor)
  visitor.visit_keyword_rest_parameter_node(self)
end

#child_nodesObject Also known as: deconstruct

def child_nodes: () -> Array[nil | Node]



3689
3690
3691
# File 'lib/yarp/node.rb', line 3689

def child_nodes
  []
end

#deconstruct_keys(keys) ⇒ Object

def deconstruct_keys: (keys: Array) -> Hash[Symbol, nil | Node | Array | String | Token | Array | Location]



3697
3698
3699
# File 'lib/yarp/node.rb', line 3697

def deconstruct_keys(keys)
  { operator_loc: operator_loc, name_loc: name_loc, location: location }
end

#nameObject

def name: () -> String?



3707
3708
3709
# File 'lib/yarp/node.rb', line 3707

def name
  name_loc&.slice
end

#operatorObject

def operator: () -> String



3702
3703
3704
# File 'lib/yarp/node.rb', line 3702

def operator
  operator_loc.slice
end