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

#pretty_print, #to_json

Constructor Details

#initialize(value:, location:, comments: []) ⇒ Retry

Returns a new instance of Retry.



7083
7084
7085
7086
7087
# File 'lib/syntax_tree/node.rb', line 7083

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



7081
7082
7083
# File 'lib/syntax_tree/node.rb', line 7081

def comments
  @comments
end

#valueObject (readonly)

String

the value of the keyword



7078
7079
7080
# File 'lib/syntax_tree/node.rb', line 7078

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



7089
7090
7091
# File 'lib/syntax_tree/node.rb', line 7089

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

#child_nodesObject Also known as: deconstruct



7093
7094
7095
# File 'lib/syntax_tree/node.rb', line 7093

def child_nodes
  []
end

#deconstruct_keys(keys) ⇒ Object



7099
7100
7101
# File 'lib/syntax_tree/node.rb', line 7099

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

#format(q) ⇒ Object



7103
7104
7105
# File 'lib/syntax_tree/node.rb', line 7103

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