From f6f8fc2ca00f624c2af9ef6d0dec07bc4cf4660e Mon Sep 17 00:00:00 2001 From: utilum <oz@utilum.com> Date: Wed, 23 May 2018 22:03:45 +0200 Subject: Avoid 2.6 warning: shadowing outer local variable - list --- activestorage/app/models/active_storage/variation.rb | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/activestorage/app/models/active_storage/variation.rb b/activestorage/app/models/active_storage/variation.rb index 806af6366d..ae1376a6cf 100644 --- a/activestorage/app/models/active_storage/variation.rb +++ b/activestorage/app/models/active_storage/variation.rb @@ -65,14 +65,12 @@ class ActiveStorage::Variation private # Applies image transformations using the ImageProcessing gem. def image_processing_transform(file, format) - operations = transformations.inject([]) do |list, (name, argument)| - list.tap do |list| - if name.to_s == "combine_options" - ActiveSupport::Deprecation.warn("The ImageProcessing ActiveStorage variant backend doesn't need :combine_options, as it already generates a single MiniMagick command. In Rails 6.1 :combine_options will not be supported anymore.") - list.concat argument.keep_if { |key, value| value.present? }.to_a - elsif argument.present? - list << [name, argument] - end + operations = transformations.each_with_object([]) do |(name, argument), list| + if name.to_s == "combine_options" + ActiveSupport::Deprecation.warn("The ImageProcessing ActiveStorage variant backend doesn't need :combine_options, as it already generates a single MiniMagick command. In Rails 6.1 :combine_options will not be supported anymore.") + list.concat argument.keep_if { |key, value| value.present? }.to_a + elsif argument.present? + list << [name, argument] end end -- cgit v1.2.3