Class: SyntaxTree::Next
Overview
Next represents using the next keyword.
next
The next keyword can also optionally be called with an argument:
next value
next can even be called with multiple arguments, but only if parentheses are omitted, as in:
next first, second, third
If a single value is being given, parentheses can be used, as in:
next(value)
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
- Args
-
the arguments passed to the next keyword.
-
#comments ⇒ Object
readonly
- Array[ Comment | EmbDoc ]
-
the comments attached to this node.
Attributes inherited from Node
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #deconstruct_keys(keys) ⇒ Object
- #format(q) ⇒ Object
-
#initialize(arguments:, location:, comments: []) ⇒ Next
constructor
A new instance of Next.
Methods inherited from Node
Constructor Details
#initialize(arguments:, location:, comments: []) ⇒ Next
Returns a new instance of Next.
6311 6312 6313 6314 6315 |
# File 'lib/syntax_tree/node.rb', line 6311 def initialize(arguments:, location:, comments: []) @arguments = arguments @location = location @comments = comments end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
- Args
-
the arguments passed to the next keyword
6306 6307 6308 |
# File 'lib/syntax_tree/node.rb', line 6306 def arguments @arguments end |
#comments ⇒ Object (readonly)
- Array[ Comment | EmbDoc ]
-
the comments attached to this node
6309 6310 6311 |
# File 'lib/syntax_tree/node.rb', line 6309 def comments @comments end |
Instance Method Details
#accept(visitor) ⇒ Object
6317 6318 6319 |
# File 'lib/syntax_tree/node.rb', line 6317 def accept(visitor) visitor.visit_next(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
6321 6322 6323 |
# File 'lib/syntax_tree/node.rb', line 6321 def child_nodes [arguments] end |
#deconstruct_keys(keys) ⇒ Object
6327 6328 6329 |
# File 'lib/syntax_tree/node.rb', line 6327 def deconstruct_keys(keys) { arguments: arguments, location: location, comments: comments } end |
#format(q) ⇒ Object
6331 6332 6333 |
# File 'lib/syntax_tree/node.rb', line 6331 def format(q) FlowControlFormatter.new("next", self).format(q) end |