Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Ruby 1.8 doesn't like sorting symbols

Switching back to set comparison rather than changing symbols to string
before sort.
  • Loading branch information...
commit 132f6da90f10bacf58fffaec61bd16b778e4e474 1 parent f5dacb6
@jnunemaker jnunemaker authored
Showing with 6 additions and 4 deletions.
  1. +6 −4 lib/plucky/criteria_hash.rb
View
10 lib/plucky/criteria_hash.rb
@@ -1,14 +1,16 @@
# encoding: UTF-8
+require 'set'
+
module Plucky
class CriteriaHash
attr_reader :source, :options
# Internal: Used to determine if criteria keys match simple id lookup.
- SimpleIdQueryKeys = [:_id]
+ SimpleIdQueryKeys = [:_id].to_set
# Internal: Used to determine if criteria keys match simple id and type
# lookup (for single collection inheritance).
- SimpleIdAndTypeQueryKeys = [:_id, :_type]
+ SimpleIdAndTypeQueryKeys = [:_id, :_type].to_set
# Internal: Used to quickly check if it is possible that the
# criteria hash is simple.
@@ -116,8 +118,8 @@ def object_ids=(value)
# query and instead just return from map.
def simple?
return false if keys.size > SimpleQueryMaxSize
- sorted_keys = keys.sort
- sorted_keys == SimpleIdQueryKeys || sorted_keys == SimpleIdAndTypeQueryKeys
+ key_set = keys.to_set
+ key_set == SimpleIdQueryKeys || key_set == SimpleIdAndTypeQueryKeys
end
private
Please sign in to comment.
Something went wrong with that request. Please try again.