Class: SyntaxTree::Retry
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 (also: #deconstruct)
- #deconstruct_keys(keys) ⇒ 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.
9109 9110 9111 9112 9113 |
# File 'lib/syntax_tree/node.rb', line 9109 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
9107 9108 9109 |
# File 'lib/syntax_tree/node.rb', line 9107 def comments @comments end |
#location ⇒ Object (readonly)
- Location
-
the location of this node
9104 9105 9106 |
# File 'lib/syntax_tree/node.rb', line 9104 def location @location end |
#value ⇒ Object (readonly)
- String
-
the value of the keyword
9101 9102 9103 |
# File 'lib/syntax_tree/node.rb', line 9101 def value @value end |
Instance Method Details
#child_nodes ⇒ Object Also known as: deconstruct
9115 9116 9117 |
# File 'lib/syntax_tree/node.rb', line 9115 def child_nodes [] end |
#deconstruct_keys(keys) ⇒ Object
9121 9122 9123 |
# File 'lib/syntax_tree/node.rb', line 9121 def deconstruct_keys(keys) { value: value, location: location, comments: comments } end |
#format(q) ⇒ Object
9125 9126 9127 |
# File 'lib/syntax_tree/node.rb', line 9125 def format(q) q.text(value) end |
#pretty_print(q) ⇒ Object
9129 9130 9131 9132 9133 9134 9135 9136 9137 9138 |
# File 'lib/syntax_tree/node.rb', line 9129 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
9140 9141 9142 9143 9144 |
# File 'lib/syntax_tree/node.rb', line 9140 def to_json(*opts) { type: :retry, value: value, loc: location, cmts: comments }.to_json( *opts ) end |