lib/rubocop/cop/style/lambda.rb in rubocop-1.53.1 vs lib/rubocop/cop/style/lambda.rb in rubocop-1.54.0
- old
+ new
@@ -67,13 +67,13 @@
selector = node.send_node.source
return unless offending_selector?(node, selector)
add_offense(node.send_node.source_range, message: message(node, selector)) do |corrector|
- if node.send_node.source == 'lambda'
- autocorrect_method_to_literal(corrector, node)
- else
+ if node.send_node.lambda_literal?
LambdaLiteralToMethodCorrector.new(node).call(corrector)
+ else
+ autocorrect_method_to_literal(corrector, node)
end
end
end
alias on_numblock on_block