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(value:, location:, comments: []) ⇒ Retry

Returns a new instance of Retry.



7804
7805
7806
7807
7808
# File 'lib/syntax_tree/node.rb', line 7804

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

Instance Attribute Details

#commentsObject (readonly)

Array[ Comment | EmbDoc ]

the comments attached to this node



7802
7803
7804
# File 'lib/syntax_tree/node.rb', line 7802

def comments
  @comments
end

#valueObject (readonly)

String

the value of the keyword



7799
7800
7801
# File 'lib/syntax_tree/node.rb', line 7799

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



7810
7811
7812
# File 'lib/syntax_tree/node.rb', line 7810

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

#child_nodesObject Also known as: deconstruct



7814
7815
7816
# File 'lib/syntax_tree/node.rb', line 7814

def child_nodes
  []
end

#deconstruct_keys(_keys) ⇒ Object



7820
7821
7822
# File 'lib/syntax_tree/node.rb', line 7820

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

#format(q) ⇒ Object



7824
7825
7826
# File 'lib/syntax_tree/node.rb', line 7824

def format(q)
  q.text(value)
end