Class: SyntaxTree::Retry
- Inherits:
-
Object
- Object
- SyntaxTree::Retry
- Defined in:
- lib/syntax_tree.rb
Overview
Retry represents the use of the retry keyword.
retry
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: []) ⇒ Retry
constructor
A new instance of Retry.
- #pretty_print(q) ⇒ Object
- #to_json(*opts) ⇒ Object
Constructor Details
#initialize(value:, location:, comments: []) ⇒ Retry
Returns a new instance of Retry.
10471 10472 10473 10474 10475 |
# File 'lib/syntax_tree.rb', line 10471 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
10469 10470 10471 |
# File 'lib/syntax_tree.rb', line 10469 def comments @comments end |
#location ⇒ Object (readonly)
- Location
-
the location of this node
10466 10467 10468 |
# File 'lib/syntax_tree.rb', line 10466 def location @location end |
#value ⇒ Object (readonly)
- String
-
the value of the keyword
10463 10464 10465 |
# File 'lib/syntax_tree.rb', line 10463 def value @value end |
Instance Method Details
#child_nodes ⇒ Object
10477 10478 10479 |
# File 'lib/syntax_tree.rb', line 10477 def child_nodes [] end |
#format(q) ⇒ Object
10481 10482 10483 |
# File 'lib/syntax_tree.rb', line 10481 def format(q) q.text(value) end |
#pretty_print(q) ⇒ Object
10485 10486 10487 10488 10489 10490 10491 10492 10493 10494 |
# File 'lib/syntax_tree.rb', line 10485 def pretty_print(q) q.group(2, "(", ")") do q.text("retry") q.breakable q.pp(value) q.pp(Comment::List.new(comments)) end end |
#to_json(*opts) ⇒ Object
10496 10497 10498 10499 10500 |
# File 'lib/syntax_tree.rb', line 10496 def to_json(*opts) { type: :retry, value: value, loc: location, cmts: comments }.to_json( *opts ) end |