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.
10017 10018 10019 10020 10021 |
# File 'lib/syntax_tree.rb', line 10017 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
10015 10016 10017 |
# File 'lib/syntax_tree.rb', line 10015 def comments @comments end |
#location ⇒ Object (readonly)
- Location
-
the location of this node
10012 10013 10014 |
# File 'lib/syntax_tree.rb', line 10012 def location @location end |
#value ⇒ Object (readonly)
- String
-
the value of the keyword
10009 10010 10011 |
# File 'lib/syntax_tree.rb', line 10009 def value @value end |
Instance Method Details
#child_nodes ⇒ Object
10023 10024 10025 |
# File 'lib/syntax_tree.rb', line 10023 def child_nodes [] end |
#format(q) ⇒ Object
10027 10028 10029 |
# File 'lib/syntax_tree.rb', line 10027 def format(q) q.text(value) end |
#pretty_print(q) ⇒ Object
10031 10032 10033 10034 10035 10036 10037 10038 10039 10040 |
# File 'lib/syntax_tree.rb', line 10031 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
10042 10043 10044 10045 10046 |
# File 'lib/syntax_tree.rb', line 10042 def to_json(*opts) { type: :retry, value: value, loc: location, cmts: comments }.to_json( *opts ) end |