Class: Prism::RetryNode

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

Overview

Represents the use of the ‘retry` keyword.

retry
^^^^^

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, node_id, location, flags) ⇒ RetryNode

Initialize a new RetryNode node.



14425
14426
14427
14428
14429
14430
# File 'lib/prism/node.rb', line 14425

def initialize(source, node_id, location, flags)
  @source = source
  @node_id = node_id
  @location = location
  @flags = flags
end

Class Method Details

.typeObject

Return a symbol representation of this node type. See ‘Node::type`.



14476
14477
14478
# File 'lib/prism/node.rb', line 14476

def self.type
  :retry_node
end

Instance Method Details

#===(other) ⇒ Object

Implements case-equality for the node. This is effectively == but without comparing the value of locations. Locations are checked only for presence.



14482
14483
14484
# File 'lib/prism/node.rb', line 14482

def ===(other)
  other.is_a?(RetryNode)
end

#accept(visitor) ⇒ Object

def accept: (Visitor visitor) -> void



14433
14434
14435
# File 'lib/prism/node.rb', line 14433

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

#child_nodesObject Also known as: deconstruct

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



14438
14439
14440
# File 'lib/prism/node.rb', line 14438

def child_nodes
  []
end

#comment_targetsObject

def comment_targets: () -> Array[Node | Location]



14448
14449
14450
# File 'lib/prism/node.rb', line 14448

def comment_targets
  [] #: Array[Prism::node | Location]
end

#compact_child_nodesObject

def compact_child_nodes: () -> Array



14443
14444
14445
# File 'lib/prism/node.rb', line 14443

def compact_child_nodes
  []
end

#copy(node_id: self.node_id, location: self.location, flags: self.flags) ⇒ Object

def copy: (?node_id: Integer, ?location: Location, ?flags: Integer) -> RetryNode



14453
14454
14455
# File 'lib/prism/node.rb', line 14453

def copy(node_id: self.node_id, location: self.location, flags: self.flags)
  RetryNode.new(source, node_id, location, flags)
end

#deconstruct_keys(keys) ⇒ Object

def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location }



14461
14462
14463
# File 'lib/prism/node.rb', line 14461

def deconstruct_keys(keys)
  { node_id: node_id, location: location }
end

#inspectObject

def inspect -> String



14466
14467
14468
# File 'lib/prism/node.rb', line 14466

def inspect
  InspectVisitor.compose(self)
end

#typeObject

Return a symbol representation of this node type. See ‘Node#type`.



14471
14472
14473
# File 'lib/prism/node.rb', line 14471

def type
  :retry_node
end