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.



7626
7627
7628
7629
7630
# File 'lib/syntax_tree/node.rb', line 7626

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



7624
7625
7626
# File 'lib/syntax_tree/node.rb', line 7624

def comments
  @comments
end

#valueObject (readonly)

String

the value of the keyword



7621
7622
7623
# File 'lib/syntax_tree/node.rb', line 7621

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



7632
7633
7634
# File 'lib/syntax_tree/node.rb', line 7632

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

#child_nodesObject Also known as: deconstruct



7636
7637
7638
# File 'lib/syntax_tree/node.rb', line 7636

def child_nodes
  []
end

#deconstruct_keys(keys) ⇒ Object



7642
7643
7644
# File 'lib/syntax_tree/node.rb', line 7642

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

#format(q) ⇒ Object



7646
7647
7648
# File 'lib/syntax_tree/node.rb', line 7646

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