about summary refs log tree commit diff
path: root/app/models/custom_filter.rb
diff options
context:
space:
mode:
authorluigi <007.lva@gmail.com>2021-01-09 18:32:01 -0500
committerGitHub <noreply@github.com>2021-01-10 00:32:01 +0100
commit087ed84367537ac168ed3e00bb7eb4bd582dc3d0 (patch)
tree2374e63ef1aabe4b9991dd30c4eba8adfec89839 /app/models/custom_filter.rb
parent93951431269403201550e914dee508a522becf8b (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 'app/models/custom_filter.rb')
-rw-r--r--app/models/custom_filter.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/custom_filter.rb b/app/models/custom_filter.rb
index 8df8a4fbf..9d0f3729b 100644
--- a/app/models/custom_filter.rb
+++ b/app/models/custom_filter.rb
@@ -46,7 +46,7 @@ class CustomFilter < ApplicationRecord
   private
 
   def clean_up_contexts
-    self.context = Array(context).map(&:strip).map(&:presence).compact
+    self.context = Array(context).map(&:strip).filter_map(&:presence)
   end
 
   def remove_cache