Class: SyntaxTree::Redo
- Inherits:
-
Object
- Object
- SyntaxTree::Redo
- Defined in:
- lib/syntax_tree.rb
Overview
Redo represents the use of the redo keyword.
redo
Instance Attribute Summary collapse
-
#comments ⇒ Object
readonly
- Array[ Comment | EmbDoc ]
-
the comments attached to this node.
-
#location ⇒ Object
readonly
- Location
-
the location of this node.
-
#value ⇒ Object
readonly
- String
-
the value of the keyword.
Instance Method Summary collapse
- #child_nodes ⇒ Object
- #format(q) ⇒ Object
-
#initialize(value:, location:, comments: []) ⇒ Redo
constructor
A new instance of Redo.
- #pretty_print(q) ⇒ Object
- #to_json(*opts) ⇒ Object
Constructor Details
#initialize(value:, location:, comments: []) ⇒ Redo
Returns a new instance of Redo.
9367 9368 9369 9370 9371 |
# File 'lib/syntax_tree.rb', line 9367 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
9365 9366 9367 |
# File 'lib/syntax_tree.rb', line 9365 def comments @comments end |
#location ⇒ Object (readonly)
- Location
-
the location of this node
9362 9363 9364 |
# File 'lib/syntax_tree.rb', line 9362 def location @location end |
#value ⇒ Object (readonly)
- String
-
the value of the keyword
9359 9360 9361 |
# File 'lib/syntax_tree.rb', line 9359 def value @value end |
Instance Method Details
#child_nodes ⇒ Object
9373 9374 9375 |
# File 'lib/syntax_tree.rb', line 9373 def child_nodes [] end |
#format(q) ⇒ Object
9377 9378 9379 |
# File 'lib/syntax_tree.rb', line 9377 def format(q) q.text(value) end |
#pretty_print(q) ⇒ Object
9381 9382 9383 9384 9385 9386 9387 9388 9389 9390 |
# File 'lib/syntax_tree.rb', line 9381 def pretty_print(q) q.group(2, "(", ")") do q.text("redo") q.breakable q.pp(value) q.pp(Comment::List.new(comments)) end end |
#to_json(*opts) ⇒ Object
9392 9393 9394 9395 9396 |
# File 'lib/syntax_tree.rb', line 9392 def to_json(*opts) { type: :redo, value: value, loc: location, cmts: comments }.to_json( *opts ) end |