diff options
author | Matt Jankowski <matt@jankowski.online> | 2023-05-02 10:10:40 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-02 16:10:40 +0200 |
commit | 5e060e1f447d91436c18e164c4d32054a9a72d5f (patch) | |
tree | d504baea2cdae90d9a1d492836657438ee78d688 /lib | |
parent | 41eb49b984b588b5b32b082a64f4af7d631bc879 (diff) |
Fix Performance/Sum cop (#24788)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/paperclip/color_extractor.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/paperclip/color_extractor.rb b/lib/paperclip/color_extractor.rb index 2e8dc04fd8e..19529fb8a16 100644 --- a/lib/paperclip/color_extractor.rb +++ b/lib/paperclip/color_extractor.rb @@ -173,7 +173,7 @@ module Paperclip def palette_from_histogram(result, quantity) frequencies = result.scan(/([0-9]+)\:/).flatten.map(&:to_f) hex_values = result.scan(/\#([0-9A-Fa-f]{6,8})/).flatten - total_frequencies = frequencies.reduce(&:+).to_f + total_frequencies = frequencies.sum.to_f frequencies.map.with_index { |f, i| [f / total_frequencies, hex_values[i]] } .sort_by { |r| -r[0] } |