Class: SyntaxTree::Redo

Inherits:
Node
  • Object
show all
Defined in:
lib/syntax_tree/node.rb

Overview

Redo represents the use of the redo keyword.

redo

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: []) ⇒ Redo

Returns a new instance of Redo.



7216
7217
7218
7219
7220
# File 'lib/syntax_tree/node.rb', line 7216

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



7214
7215
7216
# File 'lib/syntax_tree/node.rb', line 7214

def comments
  @comments
end

#valueObject (readonly)

String

the value of the keyword



7211
7212
7213
# File 'lib/syntax_tree/node.rb', line 7211

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



7222
7223
7224
# File 'lib/syntax_tree/node.rb', line 7222

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

#child_nodesObject Also known as: deconstruct



7226
7227
7228
# File 'lib/syntax_tree/node.rb', line 7226

def child_nodes
  []
end

#deconstruct_keys(_keys) ⇒ Object



7232
7233
7234
# File 'lib/syntax_tree/node.rb', line 7232

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

#format(q) ⇒ Object



7236
7237
7238
# File 'lib/syntax_tree/node.rb', line 7236

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