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, #pretty_print, #to_json

Constructor Details

#initialize(location:) ⇒ Retry

Returns a new instance of Retry.



9516
9517
9518
9519
# File 'lib/syntax_tree/node.rb', line 9516

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

Instance Attribute Details

#commentsObject (readonly)

Array[ Comment | EmbDoc ]

the comments attached to this node



9514
9515
9516
# File 'lib/syntax_tree/node.rb', line 9514

def comments
  @comments
end

Instance Method Details

#===(other) ⇒ Object



9546
9547
9548
# File 'lib/syntax_tree/node.rb', line 9546

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

#accept(visitor) ⇒ Object



9521
9522
9523
# File 'lib/syntax_tree/node.rb', line 9521

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

#child_nodesObject Also known as: deconstruct



9525
9526
9527
# File 'lib/syntax_tree/node.rb', line 9525

def child_nodes
  []
end

#copy(location: nil) ⇒ Object



9529
9530
9531
9532
9533
9534
# File 'lib/syntax_tree/node.rb', line 9529

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

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

#deconstruct_keys(_keys) ⇒ Object



9538
9539
9540
# File 'lib/syntax_tree/node.rb', line 9538

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

#format(q) ⇒ Object



9542
9543
9544
# File 'lib/syntax_tree/node.rb', line 9542

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