class SyntaxTree::Next

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)

Attributes

arguments[R]
Args

the arguments passed to the next keyword

comments[R]
Array[ Comment | EmbDoc ]

the comments attached to this node

Public Class Methods

new(arguments:, location:) click to toggle source
# File lib/syntax_tree/node.rb, line 7940
def initialize(arguments:, location:)
  @arguments = arguments
  @location = location
  @comments = []
end

Public Instance Methods

===(other) click to toggle source
# File lib/syntax_tree/node.rb, line 7975
def ===(other)
  other.is_a?(Next) && arguments === other.arguments
end
accept(visitor) click to toggle source
# File lib/syntax_tree/node.rb, line 7946
def accept(visitor)
  visitor.visit_next(self)
end
child_nodes() click to toggle source
# File lib/syntax_tree/node.rb, line 7950
def child_nodes
  [arguments]
end
Also aliased as: deconstruct
copy(arguments: nil, location: nil) click to toggle source
# File lib/syntax_tree/node.rb, line 7954
def copy(arguments: nil, location: nil)
  node =
    Next.new(
      arguments: arguments || self.arguments,
      location: location || self.location
    )

  node.comments.concat(comments.map(&:copy))
  node
end
deconstruct()
Alias for: child_nodes
deconstruct_keys(_keys) click to toggle source
# File lib/syntax_tree/node.rb, line 7967
def deconstruct_keys(_keys)
  { arguments: arguments, location: location, comments: comments }
end
format(q) click to toggle source
# File lib/syntax_tree/node.rb, line 7971
def format(q)
  FlowControlFormatter.new("next", self).format(q)
end