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.
10679 10680 10681 10682 10683 |
# File 'lib/syntax_tree.rb', line 10679 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
10677 10678 10679 |
# File 'lib/syntax_tree.rb', line 10677 def comments @comments end |
#location ⇒ Object (readonly)
- Location
-
the location of this node
10674 10675 10676 |
# File 'lib/syntax_tree.rb', line 10674 def location @location end |
#value ⇒ Object (readonly)
- String
-
the value of the keyword
10671 10672 10673 |
# File 'lib/syntax_tree.rb', line 10671 def value @value end |
Instance Method Details
#child_nodes ⇒ Object
10685 10686 10687 |
# File 'lib/syntax_tree.rb', line 10685 def child_nodes [] end |
#format(q) ⇒ Object
10689 10690 10691 |
# File 'lib/syntax_tree.rb', line 10689 def format(q) q.text(value) end |
#pretty_print(q) ⇒ Object
10693 10694 10695 10696 10697 10698 10699 10700 10701 10702 |
# File 'lib/syntax_tree.rb', line 10693 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
10704 10705 10706 10707 10708 |
# File 'lib/syntax_tree.rb', line 10704 def to_json(*opts) { type: :retry, value: value, loc: location, cmts: comments }.to_json( *opts ) end |