Class: Mongoid::FakeCriteria

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

Instance Method Summary collapse

Constructor Details

#initialize(documents) ⇒ FakeCriteria

Returns a new instance of FakeCriteria.



3
4
5
# File 'lib/mongoid/fake_criteria.rb', line 3

def initialize(documents)
  @documents = documents
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &block) ⇒ Object



15
16
17
# File 'lib/mongoid/fake_criteria.rb', line 15

def method_missing(*args, &block)
  @documents.send(*args, &block)
end

Instance Method Details

#limit(quantity) ⇒ Object



7
8
9
# File 'lib/mongoid/fake_criteria.rb', line 7

def limit(quantity)
  Mongoid::FakeCriteria.new(@documents[0..quantity-1])
end

#rawObject



11
12
13
# File 'lib/mongoid/fake_criteria.rb', line 11

def raw
  @documents
end