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



9551
9552
9553
9554
# File 'lib/syntax_tree/node.rb', line 9551

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

Instance Attribute Details

#commentsObject (readonly)

Array[ Comment | EmbDoc ]

the comments attached to this node



9549
9550
9551
# File 'lib/syntax_tree/node.rb', line 9549

def comments
  @comments
end

Instance Method Details

#===(other) ⇒ Object



9581
9582
9583
# File 'lib/syntax_tree/node.rb', line 9581

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

#accept(visitor) ⇒ Object



9556
9557
9558
# File 'lib/syntax_tree/node.rb', line 9556

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

#child_nodesObject Also known as: deconstruct



9560
9561
9562
# File 'lib/syntax_tree/node.rb', line 9560

def child_nodes
  []
end

#copy(location: nil) ⇒ Object



9564
9565
9566
9567
9568
9569
# File 'lib/syntax_tree/node.rb', line 9564

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

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

#deconstruct_keys(_keys) ⇒ Object



9573
9574
9575
# File 'lib/syntax_tree/node.rb', line 9573

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

#format(q) ⇒ Object



9577
9578
9579
# File 'lib/syntax_tree/node.rb', line 9577

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