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.



9647
9648
9649
9650
# File 'lib/syntax_tree/node.rb', line 9647

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

Instance Attribute Details

#commentsObject (readonly)

Array[ Comment | EmbDoc ]

the comments attached to this node



9645
9646
9647
# File 'lib/syntax_tree/node.rb', line 9645

def comments
  @comments
end

Instance Method Details

#===(other) ⇒ Object



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

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

#accept(visitor) ⇒ Object



9652
9653
9654
# File 'lib/syntax_tree/node.rb', line 9652

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

#child_nodesObject Also known as: deconstruct



9656
9657
9658
# File 'lib/syntax_tree/node.rb', line 9656

def child_nodes
  []
end

#copy(location: nil) ⇒ Object



9660
9661
9662
9663
9664
9665
# File 'lib/syntax_tree/node.rb', line 9660

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

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

#deconstruct_keys(_keys) ⇒ Object



9669
9670
9671
# File 'lib/syntax_tree/node.rb', line 9669

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

#format(q) ⇒ Object



9673
9674
9675
# File 'lib/syntax_tree/node.rb', line 9673

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