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



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

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



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

def keyword_loc
  @keyword_loc
end

#operator_locObject (readonly)

attr_reader operator_loc: Location



4387
4388
4389
# File 'lib/yarp/node.rb', line 4387

def operator_loc
  @operator_loc
end

Instance Method Details

#accept(visitor) ⇒ Object

def accept: (visitor: Visitor) -> void



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

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

#child_nodesObject Also known as: deconstruct

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



4405
4406
4407
# File 'lib/yarp/node.rb', line 4405

def child_nodes
  []
end

#deconstruct_keys(keys) ⇒ Object

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



4413
4414
4415
# File 'lib/yarp/node.rb', line 4413

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

#keywordObject

def keyword: () -> String



4423
4424
4425
# File 'lib/yarp/node.rb', line 4423

def keyword
  keyword_loc.slice
end

#operatorObject

def operator: () -> String



4418
4419
4420
# File 'lib/yarp/node.rb', line 4418

def operator
  operator_loc.slice
end