Class: Prism::RedoNode

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

Overview

Represents the use of the ‘redo` keyword.

redo
^^^^

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

Initialize a new RedoNode node.



15391
15392
15393
15394
15395
15396
# File 'lib/prism/node.rb', line 15391

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`.



15442
15443
15444
# File 'lib/prism/node.rb', line 15442

def self.type
  :redo_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.



15448
15449
15450
# File 'lib/prism/node.rb', line 15448

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

#accept(visitor) ⇒ Object

def accept: (Visitor visitor) -> void



15399
15400
15401
# File 'lib/prism/node.rb', line 15399

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

#child_nodesObject Also known as: deconstruct

def child_nodes: () -> Array



15404
15405
15406
# File 'lib/prism/node.rb', line 15404

def child_nodes
  []
end

#comment_targetsObject

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



15414
15415
15416
# File 'lib/prism/node.rb', line 15414

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

#compact_child_nodesObject

def compact_child_nodes: () -> Array



15409
15410
15411
# File 'lib/prism/node.rb', line 15409

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) -> RedoNode



15419
15420
15421
# File 'lib/prism/node.rb', line 15419

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

#deconstruct_keys(keys) ⇒ Object

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



15427
15428
15429
# File 'lib/prism/node.rb', line 15427

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

#inspectObject

def inspect -> String



15432
15433
15434
# File 'lib/prism/node.rb', line 15432

def inspect
  InspectVisitor.compose(self)
end

#typeObject

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



15437
15438
15439
# File 'lib/prism/node.rb', line 15437

def type
  :redo_node
end