Class: MongoMapper::Query

Inherits:
Object show all
Defined in:
lib/mongo_mapper/query.rb

Instance Method Summary collapse

Constructor Details

#initialize(model, options = {}) ⇒ Query

Returns a new instance of Query.

Raises:

  • (ArgumentError)


4
5
6
7
8
9
# File 'lib/mongo_mapper/query.rb', line 4

def initialize(model, options={})
  raise ArgumentError, "Options must be a hash" unless options.is_a?(Hash)
  @model, @options, @conditions = model, {}, {}
  query.update(options)
  add_sci_condition
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object (private)



12
13
14
# File 'lib/mongo_mapper/query.rb', line 12

def method_missing(method, *args, &block)
  query.send(method, *args, &block)
end