Sha256: 1912d8dd27a6e14f1f470cc1c989c107cfe3d4a8c7461e7c97981dc35e1f73ac
Contents?: true
Size: 828 Bytes
Versions: 1
Compression:
Stored size: 828 Bytes
Contents
# encoding: utf-8 module Mongoid #:nodoc: module Extensions #:nodoc: module Hash #:nodoc: # Expands complex criterion into mongodb selectors. module CriteriaHelpers # Expand the complex criteria into a MongoDB compliant selector hash. # # @example Convert the criterion. # {}.expand_complex_criteria # # @return [ Hash ] The mongo selector. # # @since 1.0.0 def expand_complex_criteria {}.tap do |hsh| each_pair do |k,v| case k when Mongoid::Criterion::Complex hsh[k.key] ||= {} hsh[k.key].merge!(k.to_mongo_query(v)) else hsh[k] = v end end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mongoid-2.3.0 | lib/mongoid/extensions/hash/criteria_helpers.rb |