lib/rubocop/cop/style/and_or.rb in rubocop-0.9.1 vs lib/rubocop/cop/style/and_or.rb in rubocop-0.10.0
- old
+ new
@@ -9,18 +9,14 @@
OPS = { 'and' => '&&', 'or' => '||' }
def on_and(node)
process_logical_op(node)
-
- super
end
def on_or(node)
process_logical_op(node)
-
- super
end
private
def process_logical_op(node)
@@ -34,11 +30,13 @@
do_autocorrect(node)
end
end
def autocorrect_action(node)
- replacement = (node.type == :and ? '&&' : '||')
- replace(node.loc.operator, replacement)
+ @corrections << lambda do |corrector|
+ replacement = (node.type == :and ? '&&' : '||')
+ corrector.replace(node.loc.operator, replacement)
+ end
end
end
end
end
end