Sha256: b4681e34f5a1f63768e46992d6d5f2c639e2a2ea7915944c1768b5bac82a7a75

Contents?: true

Size: 433 Bytes

Versions: 6

Compression:

Stored size: 433 Bytes

Contents

module Mongoid #:nodoc:
  module Extensions #:nodoc:
    module Hash #:nodoc:
      module CriteriaHelpers #:nodoc:
        def expand_complex_criteria
          hsh = {}
          self.each_pair do |k,v|
            if k.class == Mongoid::ComplexCriterion
              hsh[k.key] = {"$#{k.operator}" => v}
            else
              hsh[k] = v
            end
          end
          hsh
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mongoid-0.10.5 lib/mongoid/extensions/hash/criteria_helpers.rb
mongoid-0.10.4 lib/mongoid/extensions/hash/criteria_helpers.rb
mongoid-0.10.3 lib/mongoid/extensions/hash/criteria_helpers.rb
mongoid-0.10.2 lib/mongoid/extensions/hash/criteria_helpers.rb
mongoid-0.10.1 lib/mongoid/extensions/hash/criteria_helpers.rb
mongoid-0.10.0 lib/mongoid/extensions/hash/criteria_helpers.rb