Parent

Files

Class/Module Index [+]

Quicksearch

RuboCop::Cop::Style::WhileUntilDo

Checks for uses of `do` in multi-line `while/until` statements.

Public Instance Methods

handle(node) click to toggle source
# File lib/rubocop/cop/style/while_until_do.rb, line 15
def handle(node)
  length = node.loc.expression.source.lines.to_a.size
  return unless length > 1
  return unless  node.loc.begin && node.loc.begin.is?('do')

  add_offense(node, :begin, error_message(node.type))
end
on_until(node) click to toggle source
# File lib/rubocop/cop/style/while_until_do.rb, line 11
def on_until(node)
  handle(node)
end
on_while(node) click to toggle source
# File lib/rubocop/cop/style/while_until_do.rb, line 7
def on_while(node)
  handle(node)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.