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



8101
8102
8103
8104
8105
# File 'lib/syntax_tree/node.rb', line 8101

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



8099
8100
8101
# File 'lib/syntax_tree/node.rb', line 8099

def comments
  @comments
end

#valueObject (readonly)

String

the value of the keyword



8096
8097
8098
# File 'lib/syntax_tree/node.rb', line 8096

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



8107
8108
8109
# File 'lib/syntax_tree/node.rb', line 8107

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

#child_nodesObject Also known as: deconstruct



8111
8112
8113
# File 'lib/syntax_tree/node.rb', line 8111

def child_nodes
  []
end

#deconstruct_keys(_keys) ⇒ Object



8117
8118
8119
# File 'lib/syntax_tree/node.rb', line 8117

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

#format(q) ⇒ Object



8121
8122
8123
# File 'lib/syntax_tree/node.rb', line 8121

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