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.



7836
7837
7838
7839
7840
# File 'lib/syntax_tree/node.rb', line 7836

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

Instance Attribute Details

#comments ⇒ Object (readonly)

[Array[ Comment | EmbDoc ]] the comments attached to this node



7834
7835
7836
# File 'lib/syntax_tree/node.rb', line 7834

def comments
  @comments
end

#value ⇒ Object (readonly)

[String] the value of the keyword



7831
7832
7833
# File 'lib/syntax_tree/node.rb', line 7831

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



7842
7843
7844
# File 'lib/syntax_tree/node.rb', line 7842

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

#child_nodes ⇒ Object Also known as: deconstruct



7846
7847
7848
# File 'lib/syntax_tree/node.rb', line 7846

def child_nodes
  []
end

#deconstruct_keys(_keys) ⇒ Object



7852
7853
7854
# File 'lib/syntax_tree/node.rb', line 7852

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

#format(q) ⇒ Object



7856
7857
7858
# File 'lib/syntax_tree/node.rb', line 7856

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