lib/mongoid/criteria/queryable/selector.rb
# Evolves a multi-list selection, like an $and or $or criterion, and
# performs the necessary serialization.
#
# @example Evolve the multi-selection.
#   selector.evolve_multi([{ field: "value" }])
#
# @param [ Array<Hash> ] specs The multi-selection.
#
# @return [ Array<Hash> ] The serialized values.
#
# @api private
Evolves a multi-list selection, like an $and or $or criterion, and
performs the necessary serialization.
Evolves a multi - list selection like an $and or $or criterion and performs the necessary serialization .
def evolve_multi(specs)
          unless specs.is_a?(Array)
            raise ArgumentError, "specs is not an array: #{specs.inspect}"
          end
          specs.map do |spec|
            Hash[spec.map do |key, value|
              if multi_selection?(key)
                value = evolve_multi(value)
              end
              name, serializer = storage_pair(key)
              final_key, evolved_value = store_creds(name, serializer, value)
              if key.is_a?(Key)
                evolved_value = key.transform_value(evolved_value)
              end
              [ final_key, evolved_value ]
            end]
          end.uniq
        end
def evolve_multi ( specs ) unless specs . is_a? ( Array ) raise ArgumentError , "specs is not an array: #{specs.inspect}" end specs . map do | spec | Hash [ spec . map do | key , value | if multi_selection? ( key ) value = evolve_multi ( value ) end name , serializer = storage_pair ( key ) final_key , evolved_value = store_creds ( name , serializer , value ) if key . is_a? ( Key ) evolved_value = key . transform_value ( evolved_value ) end [ final_key , evolved_value ] end ] end . uniq end
Evolves a multi-list selection, like an $and or $or criterion, and
performs the necessary serialization.
Evolves a multi - list selection like an $and or $or criterion and performs the necessary serialization .
# If an application nests conditionals, e.g. # {'$or' => [{'$or' => {...}}]}, # when evolve_multi is called for the top level hash, # this call recursively transforms the bottom level $or. # storage_pair handles field aliases but not localization for # some reason, although per its documentation Smash supposedly # owns both. # This performs type conversions on the value and transformations # that depend on the type of the field that the value is stored # in, but not transformations that have to do with query shape. # This builds a query shape around the value, when the query # involves complex keys. For example, {:foo.lt => 5} produces # {'foo' => {'$lt' => 5}}. This step should be done after all # value-based processing is complete.
The serialized values.
The serialized values .
 Array<Hash> 
specs
<not_specific>
<not_specific>
specs The multi-selection.
specs The multi - selection .
example
Evolve the multi-selection. selector.evolve_multi([{ field: "value" }])
Evolve the multi - selection . selector . evolve_multi ( [ { field : " value " } ] )
api
None