class Rubocop::Cop::Style::WhenThen

This cop checks for when; uses in case expressions.

Constants

MSG

Public Instance Methods

autocorrect_action(node) click to toggle source
# File lib/rubocop/cop/style/when_then.rb, line 19
def autocorrect_action(node)
  replace(node.loc.begin, ' then')
end
on_when(node) click to toggle source
Calls superclass method
# File lib/rubocop/cop/style/when_then.rb, line 10
def on_when(node)
  if node.loc.begin && node.loc.begin.is?(';')
    add_offence(:convention, node.loc.begin, MSG)
    do_autocorrect(node)
  end

  super
end