class RuboCop::AST::ForNode

to all ‘for` nodes within RuboCop.
node when the builder constructs the AST, making its methods available
A node extension for `for` nodes. This will be used in place of a plain

def body

Returns:
  • (Node, nil) - The body of the `for` loop.
def body
  node_parts[2]
end

def collection

Returns:
  • (Node) - The collection the `for` loop is iterating over
def collection
  node_parts[1]
end

def do?

Returns:
  • (Boolean) - whether the `for` node has a `do` keyword
def do?
  loc.begin&.is?('do')
end

def keyword

Returns:
  • (String) - the keyword of the `until` statement
def keyword
  'for'
end

def variable

Returns:
  • (Node) - The iteration variable of the `for` loop
def variable
  node_parts[0]
end

def void_context?

Returns:
  • (true) - whether the `for` node body is a void context
def void_context?
  true
end