Parent

Files

Class/Module Index [+]

Quicksearch

RuboCop::Cop::Style::WhenThen

This cop checks for when; uses in case expressions.

Constants

MSG

Public Instance Methods

autocorrect(node) click to toggle source
# File lib/rubocop/cop/style/when_then.rb, line 15
def autocorrect(node)
  @corrections << lambda do |corrector|
    corrector.replace(node.loc.begin, ' then')
  end
end
on_when(node) click to toggle source
# File lib/rubocop/cop/style/when_then.rb, line 9
def on_when(node)
  return unless node.loc.begin && node.loc.begin.is?(';')

  add_offense(node, :begin)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.