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
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
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
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
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