Permalink
Browse files

Remove duplication of modifier checking.

My goodness I hate that merge method. It must die...
  • Loading branch information...
jnunemaker committed Oct 11, 2012
1 parent 24a6b56 commit 3a35c38479c577a4aa936dbe25990c58f1fd35e7
Showing with 2 additions and 2 deletions.
  1. +2 −2 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

0 comments on commit 3a35c38

Please sign in to comment.