REFACTOR: compact! works since the array can't contain empty strings

REFACTOR: compact! works since the array can’t contain empty strings

From bf27aecce25c2b8267312045b93b511dd5eb3b92 Mon Sep 17 00:00:00 2001
From: Gerhard Schlager <mail@gerhard-schlager.at>
Date: Thu, 22 Nov 2018 13:27:34 +0100
Subject: [PATCH] REFACTOR: compact! works since the array can't contain empty
 strings


diff --git a/lib/search.rb b/lib/search.rb
index dd41ed9..e26f8c2 100644
--- a/lib/search.rb
+++ b/lib/search.rb
@@ -833,7 +833,7 @@ class Search
     all_terms = data.scan(/'([^']+)'\:\d+/).flatten
     all_terms.map! do |t|
       t.split(/[\)\(&']/).find(&:present?)
-    end.reject!(&:blank?)
+    end.compact!
 
     query = ActiveRecord::Base.connection.quote(
       all_terms

GitHub