Class: YARP::NoKeywordsParameterNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::NoKeywordsParameterNode
- 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
-
#keyword_loc ⇒ Object
readonly
attr_reader keyword_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].
-
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location].
-
#copy(**params) ⇒ Object
def copy: (**params) -> NoKeywordsParameterNode.
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(operator_loc, keyword_loc, location) ⇒ NoKeywordsParameterNode
constructor
def initialize: (operator_loc: Location, keyword_loc: Location, location: Location) -> void.
- #inspect(inspector = NodeInspector.new) ⇒ Object
-
#keyword ⇒ Object
def keyword: () -> String.
-
#operator ⇒ Object
def operator: () -> String.
Constructor Details
#initialize(operator_loc, keyword_loc, location) ⇒ NoKeywordsParameterNode
def initialize: (operator_loc: Location, keyword_loc: Location, location: Location) -> void
7474 7475 7476 7477 7478 |
# File 'lib/yarp/node.rb', line 7474 def initialize(operator_loc, keyword_loc, location) @operator_loc = operator_loc @keyword_loc = keyword_loc @location = location end |
Instance Attribute Details
#keyword_loc ⇒ Object (readonly)
attr_reader keyword_loc: Location
7471 7472 7473 |
# File 'lib/yarp/node.rb', line 7471 def keyword_loc @keyword_loc end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location
7468 7469 7470 |
# File 'lib/yarp/node.rb', line 7468 def operator_loc @operator_loc end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
7481 7482 7483 |
# File 'lib/yarp/node.rb', line 7481 def accept(visitor) visitor.visit_no_keywords_parameter_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
7486 7487 7488 |
# File 'lib/yarp/node.rb', line 7486 def child_nodes [] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
7491 7492 7493 |
# File 'lib/yarp/node.rb', line 7491 def comment_targets [operator_loc, keyword_loc] end |
#copy(**params) ⇒ Object
def copy: (**params) -> NoKeywordsParameterNode
7496 7497 7498 7499 7500 7501 7502 |
# File 'lib/yarp/node.rb', line 7496 def copy(**params) NoKeywordsParameterNode.new( params.fetch(:operator_loc) { operator_loc }, params.fetch(:keyword_loc) { keyword_loc }, params.fetch(:location) { location }, ) end |
#deconstruct_keys(keys) ⇒ Object
7508 7509 7510 |
# File 'lib/yarp/node.rb', line 7508 def deconstruct_keys(keys) { operator_loc: operator_loc, keyword_loc: keyword_loc, location: location } end |
#inspect(inspector = NodeInspector.new) ⇒ Object
7522 7523 7524 7525 7526 7527 |
# File 'lib/yarp/node.rb', line 7522 def inspect(inspector = NodeInspector.new) inspector << inspector.header(self) inspector << "├── operator_loc: #{inspector.location(operator_loc)}\n" inspector << "└── keyword_loc: #{inspector.location(keyword_loc)}\n" inspector.to_str end |
#keyword ⇒ Object
def keyword: () -> String
7518 7519 7520 |
# File 'lib/yarp/node.rb', line 7518 def keyword keyword_loc.slice end |
#operator ⇒ Object
def operator: () -> String
7513 7514 7515 |
# File 'lib/yarp/node.rb', line 7513 def operator operator_loc.slice end |