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.
10547 10548 10549 10550 10551 |
# File 'lib/syntax_tree.rb', line 10547 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
10545 10546 10547 |
# File 'lib/syntax_tree.rb', line 10545 def comments @comments end |
#location ⇒ Object (readonly)
- Location
-
the location of this node
10542 10543 10544 |
# File 'lib/syntax_tree.rb', line 10542 def location @location end |
#value ⇒ Object (readonly)
- String
-
the value of the keyword
10539 10540 10541 |
# File 'lib/syntax_tree.rb', line 10539 def value @value end |
Instance Method Details
#child_nodes ⇒ Object
10553 10554 10555 |
# File 'lib/syntax_tree.rb', line 10553 def child_nodes [] end |
#format(q) ⇒ Object
10557 10558 10559 |
# File 'lib/syntax_tree.rb', line 10557 def format(q) q.text(value) end |
#pretty_print(q) ⇒ Object
10561 10562 10563 10564 10565 10566 10567 10568 10569 10570 |
# File 'lib/syntax_tree.rb', line 10561 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
10572 10573 10574 10575 10576 |
# File 'lib/syntax_tree.rb', line 10572 def to_json(*opts) { type: :retry, value: value, loc: location, cmts: comments }.to_json( *opts ) end |