Class: SyntaxTree::Retry

Inherits:
Node
  • Object
show all
Defined in:
lib/syntax_tree/node.rb

Overview

Retry represents the use of the retry keyword.

retry

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:) ⇒ Retry

Returns a new instance of Retry.



9680
9681
9682
9683
# File 'lib/syntax_tree/node.rb', line 9680

def initialize(location:)
  @location = location
  @comments = []
end

Instance Attribute Details

#commentsObject (readonly)

Array[ Comment | EmbDoc ]

the comments attached to this node



9678
9679
9680
# File 'lib/syntax_tree/node.rb', line 9678

def comments
  @comments
end

Instance Method Details

#===(other) ⇒ Object



9710
9711
9712
# File 'lib/syntax_tree/node.rb', line 9710

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

#accept(visitor) ⇒ Object



9685
9686
9687
# File 'lib/syntax_tree/node.rb', line 9685

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

#child_nodesObject Also known as: deconstruct



9689
9690
9691
# File 'lib/syntax_tree/node.rb', line 9689

def child_nodes
  []
end

#copy(location: nil) ⇒ Object



9693
9694
9695
9696
9697
9698
# File 'lib/syntax_tree/node.rb', line 9693

def copy(location: nil)
  node = Retry.new(location: location || self.location)

  node.comments.concat(comments.map(&:copy))
  node
end

#deconstruct_keys(_keys) ⇒ Object



9702
9703
9704
# File 'lib/syntax_tree/node.rb', line 9702

def deconstruct_keys(_keys)
  { location: location, comments: comments }
end

#format(q) ⇒ Object



9706
9707
9708
# File 'lib/syntax_tree/node.rb', line 9706

def format(q)
  q.text("retry")
end