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
#construct_keys, #pretty_print, #to_json
Constructor Details
#initialize(arguments:, location:, comments: []) ⇒ Next
Returns a new instance of Next.
6523 6524 6525 6526 6527 |
# File 'lib/syntax_tree/node.rb', line 6523 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
6518 6519 6520 |
# File 'lib/syntax_tree/node.rb', line 6518 def arguments @arguments end |
#comments ⇒ Object (readonly)
- Array[ Comment | EmbDoc ]
-
the comments attached to this node
6521 6522 6523 |
# File 'lib/syntax_tree/node.rb', line 6521 def comments @comments end |
Instance Method Details
#accept(visitor) ⇒ Object
6529 6530 6531 |
# File 'lib/syntax_tree/node.rb', line 6529 def accept(visitor) visitor.visit_next(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
6533 6534 6535 |
# File 'lib/syntax_tree/node.rb', line 6533 def child_nodes [arguments] end |
#deconstruct_keys(_keys) ⇒ Object
6539 6540 6541 |
# File 'lib/syntax_tree/node.rb', line 6539 def deconstruct_keys(_keys) { arguments: arguments, location: location, comments: comments } end |
#format(q) ⇒ Object
6543 6544 6545 |
# File 'lib/syntax_tree/node.rb', line 6543 def format(q) FlowControlFormatter.new("next", self).format(q) end |