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 30
def do?
  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 23
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 15
def keyword
  'while'
end