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.



16309
16310
16311
16312
16313
16314
# File 'lib/prism/node.rb', line 16309

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.



16366
16367
16368
# File 'lib/prism/node.rb', line 16366

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.



16372
16373
16374
# File 'lib/prism/node.rb', line 16372

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

#accept(visitor) ⇒ Object

def accept: (Visitor visitor) -> void



16317
16318
16319
# File 'lib/prism/node.rb', line 16317

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

#child_nodesObject Also known as: deconstruct

def child_nodes: () -> Array



16322
16323
16324
# File 'lib/prism/node.rb', line 16322

def child_nodes
  []
end

#comment_targetsObject

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



16338
16339
16340
# File 'lib/prism/node.rb', line 16338

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

#compact_child_nodesObject

def compact_child_nodes: () -> Array



16333
16334
16335
# File 'lib/prism/node.rb', line 16333

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



16343
16344
16345
# File 'lib/prism/node.rb', line 16343

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 }



16351
16352
16353
# File 'lib/prism/node.rb', line 16351

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

#each_child_nodeObject

def each_child_node: () { (Prism::node) -> void } -> void | () -> Enumerator



16327
16328
16329
16330
# File 'lib/prism/node.rb', line 16327

def each_child_node
  return to_enum(:each_child_node) unless block_given?

end

#inspectObject

def inspect -> String



16356
16357
16358
# File 'lib/prism/node.rb', line 16356

def inspect
  InspectVisitor.compose(self)
end

#typeObject

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



16361
16362
16363
# File 'lib/prism/node.rb', line 16361

def type
  :redo_node
end