Class: YARP::NextNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::NextNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents the use of the ‘next` keyword.
next 1
^^^^^^
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
attr_reader arguments: ArgumentsNode?.
-
#keyword_loc ⇒ Object
readonly
attr_reader keyword_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) -> NextNode.
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(arguments, keyword_loc, location) ⇒ NextNode
constructor
def initialize: (arguments: ArgumentsNode?, keyword_loc: Location, location: Location) -> void.
- #inspect(inspector = NodeInspector.new) ⇒ Object
-
#keyword ⇒ Object
def keyword: () -> String.
Constructor Details
#initialize(arguments, keyword_loc, location) ⇒ NextNode
def initialize: (arguments: ArgumentsNode?, keyword_loc: Location, location: Location) -> void
7359 7360 7361 7362 7363 |
# File 'lib/yarp/node.rb', line 7359 def initialize(arguments, keyword_loc, location) @arguments = arguments @keyword_loc = keyword_loc @location = location end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
attr_reader arguments: ArgumentsNode?
7353 7354 7355 |
# File 'lib/yarp/node.rb', line 7353 def arguments @arguments end |
#keyword_loc ⇒ Object (readonly)
attr_reader keyword_loc: Location
7356 7357 7358 |
# File 'lib/yarp/node.rb', line 7356 def keyword_loc @keyword_loc end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
7366 7367 7368 |
# File 'lib/yarp/node.rb', line 7366 def accept(visitor) visitor.visit_next_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
7371 7372 7373 |
# File 'lib/yarp/node.rb', line 7371 def child_nodes [arguments] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
7376 7377 7378 |
# File 'lib/yarp/node.rb', line 7376 def comment_targets [*arguments, keyword_loc] end |
#copy(**params) ⇒ Object
def copy: (**params) -> NextNode
7381 7382 7383 7384 7385 7386 7387 |
# File 'lib/yarp/node.rb', line 7381 def copy(**params) NextNode.new( params.fetch(:arguments) { arguments }, params.fetch(:keyword_loc) { keyword_loc }, params.fetch(:location) { location }, ) end |
#deconstruct_keys(keys) ⇒ Object
7393 7394 7395 |
# File 'lib/yarp/node.rb', line 7393 def deconstruct_keys(keys) { arguments: arguments, keyword_loc: keyword_loc, location: location } end |
#inspect(inspector = NodeInspector.new) ⇒ Object
7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 |
# File 'lib/yarp/node.rb', line 7402 def inspect(inspector = NodeInspector.new) inspector << inspector.header(self) if (arguments = self.arguments).nil? inspector << "├── arguments: ∅\n" else inspector << "├── arguments:\n" inspector << arguments.inspect(inspector.child_inspector("│ ")).delete_prefix(inspector.prefix) end inspector << "└── keyword_loc: #{inspector.location(keyword_loc)}\n" inspector.to_str end |
#keyword ⇒ Object
def keyword: () -> String
7398 7399 7400 |
# File 'lib/yarp/node.rb', line 7398 def keyword keyword_loc.slice end |