diff options
author | luigi <007.lva@gmail.com> | 2021-01-09 18:32:01 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-10 00:32:01 +0100 |
commit | 087ed84367537ac168ed3e00bb7eb4bd582dc3d0 (patch) | |
tree | 2374e63ef1aabe4b9991dd30c4eba8adfec89839 /lib/paperclip | |
parent | 93951431269403201550e914dee508a522becf8b (diff) |
Optimize map { ... }.compact calls (#15513)
* Optimize map { ... }.compact using Enumerable#filter_map, supported since Ruby 2.7 * Add poyfill for Enumerable#filter_map
Diffstat (limited to 'lib/paperclip')
-rw-r--r-- | lib/paperclip/attachment_extensions.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/paperclip/attachment_extensions.rb b/lib/paperclip/attachment_extensions.rb index 94f7769b6..e25a34213 100644 --- a/lib/paperclip/attachment_extensions.rb +++ b/lib/paperclip/attachment_extensions.rb @@ -27,7 +27,7 @@ module Paperclip return true if original_filename == other_filename return false if original_filename.nil? - formats = styles.values.map(&:format).compact + formats = styles.values.filter_map(&:format) return false if formats.empty? |