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.



7327
7328
7329
7330
7331
# File 'lib/syntax_tree/node.rb', line 7327

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



7325
7326
7327
# File 'lib/syntax_tree/node.rb', line 7325

def comments
  @comments
end

#value ⇒ Object (readonly)

[String] the value of the keyword



7322
7323
7324
# File 'lib/syntax_tree/node.rb', line 7322

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



7333
7334
7335
# File 'lib/syntax_tree/node.rb', line 7333

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

#child_nodes ⇒ Object Also known as: deconstruct



7337
7338
7339
# File 'lib/syntax_tree/node.rb', line 7337

def child_nodes
  []
end

#deconstruct_keys(_keys) ⇒ Object



7343
7344
7345
# File 'lib/syntax_tree/node.rb', line 7343

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

#format(q) ⇒ Object



7347
7348
7349
# File 'lib/syntax_tree/node.rb', line 7347

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