Module: Mongoid::Extensions::Hash::CriteriaHelpers
- Defined in:
- lib/mongoid/geo/criteria_helpers.rb
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#expand_complex_criteria ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/mongoid/geo/criteria_helpers.rb', line 6 def hsh = {} each_pair do |k,v| case k when Mongoid::Criterion::Complex hsh[k.key] ||= {} hsh[k.key].merge!(k.make_hash(v)) when Mongoid::Criterion::OuterOperator hsh[k.key] ||= {} hsh[k.key].merge!(k.make_hash(v)) when Mongoid::Criterion::TwinOperators raise "TwinOperators expects an array with a value for each of the twin operators" if !v.kind_of?(Array) && !v.size == 2 hsh[k.key] ||= {} hsh[k.key].merge!(k.make_hash(v)) else hsh[k] = v end end hsh end |