Skip to content

Commit

Permalink
Remove duplication of modifier checking.
Browse files Browse the repository at this point in the history
My goodness I hate that merge method. It must die...
  • Loading branch information
jnunemaker committed Oct 11, 2012
1 parent 24a6b56 commit 3a35c38
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/plucky/criteria_hash.rb
Expand Up @@ -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
Expand Down

0 comments on commit 3a35c38

Please sign in to comment.