Class Mongoid::Criterion::Selector
In: lib/mongoid/criterion/selector.rb
Parent: Hash

The selector is a hash-like object that has special behaviour for merging mongoid criteria selectors.

Methods

[]=   inspect   merge!   new   update  

Attributes

fields  [R] 
klass  [R] 

Public Class methods

Create the new selector.

@example Create the selector.

  Selector.new(Person)

@param [ Class ] klass The class the selector is for.

@since 1.0.0

Public Instance methods

Set the value for the supplied key, attempting to typecast the value.

@example Set the value for the key.

  selector["$ne"] = { :name => "Zorg" }

@param [ String, Symbol ] key The hash key. @param [ Object ] value The value to set.

@since 2.0.0

Generate pretty inspection for old ruby versions.

@example Inspect the selector.

  selector.inspect

@return [ String ] The inspected selector.

Merge the selector with another hash.

@example Merge the objects.

  selector.merge!({ :key => "value" })

@param [ Hash, Selector ] other The object to merge with.

@return [ Selector ] The merged selector.

@since 1.0.0

update(other)

Alias for merge!

[Validate]