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.



13683
13684
13685
13686
13687
13688
# File 'lib/prism/node.rb', line 13683

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



13734
13735
13736
# File 'lib/prism/node.rb', line 13734

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.



13740
13741
13742
# File 'lib/prism/node.rb', line 13740

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

#accept(visitor) ⇒ Object

def accept: (Visitor visitor) -> void



13691
13692
13693
# File 'lib/prism/node.rb', line 13691

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

#child_nodesObject Also known as: deconstruct

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



13696
13697
13698
# File 'lib/prism/node.rb', line 13696

def child_nodes
  []
end

#comment_targetsObject

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



13706
13707
13708
# File 'lib/prism/node.rb', line 13706

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

#compact_child_nodesObject

def compact_child_nodes: () -> Array



13701
13702
13703
# File 'lib/prism/node.rb', line 13701

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



13711
13712
13713
# File 'lib/prism/node.rb', line 13711

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 }



13719
13720
13721
# File 'lib/prism/node.rb', line 13719

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

#inspectObject

def inspect -> String



13724
13725
13726
# File 'lib/prism/node.rb', line 13724

def inspect
  InspectVisitor.compose(self)
end

#typeObject

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



13729
13730
13731
# File 'lib/prism/node.rb', line 13729

def type
  :redo_node
end