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.



13720
13721
13722
13723
13724
13725
# File 'lib/prism/node.rb', line 13720

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



13771
13772
13773
# File 'lib/prism/node.rb', line 13771

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.



13777
13778
13779
# File 'lib/prism/node.rb', line 13777

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

#accept(visitor) ⇒ Object

def accept: (Visitor visitor) -> void



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

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

#child_nodesObject Also known as: deconstruct

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



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

def child_nodes
  []
end

#comment_targetsObject

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



13743
13744
13745
# File 'lib/prism/node.rb', line 13743

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

#compact_child_nodesObject

def compact_child_nodes: () -> Array



13738
13739
13740
# File 'lib/prism/node.rb', line 13738

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



13748
13749
13750
# File 'lib/prism/node.rb', line 13748

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 }



13756
13757
13758
# File 'lib/prism/node.rb', line 13756

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

#inspectObject

def inspect -> String



13761
13762
13763
# File 'lib/prism/node.rb', line 13761

def inspect
  InspectVisitor.compose(self)
end

#typeObject

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



13766
13767
13768
# File 'lib/prism/node.rb', line 13766

def type
  :redo_node
end