Class: YARP::NoKeywordsParameterNode

Inherits:
YARPNode
  • Object
show all
Defined in:
lib/yarp/node.rb,
ext/yarp/api_node.c

Overview

Represents the use of ‘**nil` inside method arguments.

def a(**nil)
      ^^^^^
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(operator_loc, keyword_loc, location) ⇒ NoKeywordsParameterNode

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



4368
4369
4370
4371
4372
# File 'lib/yarp/node.rb', line 4368

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

Instance Attribute Details

#keyword_locObject (readonly)

attr_reader keyword_loc: Location



4365
4366
4367
# File 'lib/yarp/node.rb', line 4365

def keyword_loc
  @keyword_loc
end

#operator_locObject (readonly)

attr_reader operator_loc: Location



4362
4363
4364
# File 'lib/yarp/node.rb', line 4362

def operator_loc
  @operator_loc
end

Instance Method Details

#accept(visitor) ⇒ Object

def accept: (visitor: Visitor) -> void



4375
4376
4377
# File 'lib/yarp/node.rb', line 4375

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

#child_nodesObject Also known as: deconstruct

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



4381
4382
4383
# File 'lib/yarp/node.rb', line 4381

def child_nodes
  []
end

#deconstruct_keys(keys) ⇒ Object

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



4389
4390
4391
# File 'lib/yarp/node.rb', line 4389

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

#keywordObject

def keyword: () -> String



4399
4400
4401
# File 'lib/yarp/node.rb', line 4399

def keyword
  keyword_loc.slice
end

#operatorObject

def operator: () -> String



4394
4395
4396
# File 'lib/yarp/node.rb', line 4394

def operator
  operator_loc.slice
end