Class: SyntaxTree::Redo
- Inherits:
-
Node
- Object
- Node
- SyntaxTree::Redo
show all
- Defined in:
- lib/syntax_tree/node.rb
Overview
Redo represents the use of the redo keyword.
redo
Instance Attribute Summary collapse
Attributes inherited from Node
#location
Instance Method Summary
collapse
Methods inherited from Node
#construct_keys, #end_char, #pretty_print, #start_char, #to_json, #to_mermaid
Constructor Details
#initialize(location:) ⇒ Redo
Returns a new instance of Redo.
9039
9040
9041
9042
|
# File 'lib/syntax_tree/node.rb', line 9039
def initialize(location:)
@location = location
@comments = []
end
|
Instance Attribute Details
- Array[ Comment | EmbDoc ]
-
the comments attached to this node
9037
9038
9039
|
# File 'lib/syntax_tree/node.rb', line 9037
def
@comments
end
|
Instance Method Details
#===(other) ⇒ Object
9069
9070
9071
|
# File 'lib/syntax_tree/node.rb', line 9069
def ===(other)
other.is_a?(Redo)
end
|
#accept(visitor) ⇒ Object
9044
9045
9046
|
# File 'lib/syntax_tree/node.rb', line 9044
def accept(visitor)
visitor.visit_redo(self)
end
|
#child_nodes ⇒ Object
Also known as:
deconstruct
9048
9049
9050
|
# File 'lib/syntax_tree/node.rb', line 9048
def child_nodes
[]
end
|
#copy(location: nil) ⇒ Object
9052
9053
9054
9055
9056
9057
|
# File 'lib/syntax_tree/node.rb', line 9052
def copy(location: nil)
node = Redo.new(location: location || self.location)
node..concat(.map(&:copy))
node
end
|
#deconstruct_keys(_keys) ⇒ Object
9061
9062
9063
|
# File 'lib/syntax_tree/node.rb', line 9061
def deconstruct_keys(_keys)
{ location: location, comments: }
end
|
9065
9066
9067
|
# File 'lib/syntax_tree/node.rb', line 9065
def format(q)
q.text("redo")
end
|