From 3a35c38479c577a4aa936dbe25990c58f1fd35e7 Mon Sep 17 00:00:00 2001 From: John Nunemaker Date: Thu, 11 Oct 2012 09:11:00 -0400 Subject: [PATCH] Remove duplication of modifier checking. My goodness I hate that merge method. It must die... --- lib/plucky/criteria_hash.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/plucky/criteria_hash.rb b/lib/plucky/criteria_hash.rb index 449b630..8064976 100644 --- a/lib/plucky/criteria_hash.rb +++ b/lib/plucky/criteria_hash.rb @@ -76,13 +76,13 @@ def merge(other) end end elsif value_is_hash && !other_is_hash - if modifier_key = value.keys.detect { |k| k.to_s[0, 1] == '$' } + if modifier_key = value.keys.detect { |k| Plucky.modifier?(k) } value[modifier_key].concat(Array(other_value)).uniq! else # kaboom! Array(value).concat(Array(other_value)).uniq end elsif other_is_hash && !value_is_hash - if modifier_key = other_value.keys.detect { |k| k.to_s[0, 1] == '$' } + if modifier_key = other_value.keys.detect { |k| Plucky.modifier?(k) } other_value[modifier_key].concat(Array(value)).uniq! else # kaboom! Array(value).concat(Array(other_value)).uniq