Class: Mongoid::Criterion::Complex

Inherits:
Object
  • Object
show all
Defined in:
lib/mongoid/criterion/complex.rb

Overview

Complex criterion are used when performing operations on symbols to get get a shorthand syntax for where clauses.

Example:

{ :field => { "$lt" => "value" } } becomes: { :field.lt => "value }

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Complex

Create the new complex criterion.



16
17
18
# File 'lib/mongoid/criterion/complex.rb', line 16

def initialize(opts = {})
  @key, @operator = opts[:key], opts[:operator]
end

Instance Attribute Details

#keyObject

Returns the value of attribute key.



13
14
15
# File 'lib/mongoid/criterion/complex.rb', line 13

def key
  @key
end

#operatorObject

Returns the value of attribute operator.



13
14
15
# File 'lib/mongoid/criterion/complex.rb', line 13

def operator
  @operator
end