class RuboCop::AST::WhileNode

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

Public Instance Methods

do?() click to toggle source

Checks whether the `until` node has a `do` keyword.

@return [Boolean] whether the `until` node has a `do` keyword

# File lib/rubocop/ast/node/while_node.rb, line 29
def do?
  loc.begin && loc.begin.is?('do')
end
inverse_keyword() click to toggle source

Returns the inverse keyword of the `while` node as a string. Returns `until` for `while` nodes and vice versa.

@return [String] the inverse keyword of the `while` statement

# File lib/rubocop/ast/node/while_node.rb, line 22
def inverse_keyword
  'until'
end
keyword() click to toggle source

Returns the keyword of the `while` statement as a string.

@return [String] the keyword of the `while` statement

# File lib/rubocop/ast/node/while_node.rb, line 14
def keyword
  'while'
end
node_parts() click to toggle source

Custom destructuring method. This can be used to normalize destructuring for different variations of the node.

@return [Array<Node>] the different parts of the `while` statement

# File lib/rubocop/ast/node/while_node.rb, line 37
def node_parts
  to_a
end