Class: ProfileCollection
- Inherits:
-
Object
- Object
- ProfileCollection
- Defined in:
- lib/mongo/mongo.rb
Instance Method Summary collapse
- #each ⇒ Object
- #get_last_document_date ⇒ Object
-
#initialize(documents, parser) ⇒ ProfileCollection
constructor
A new instance of ProfileCollection.
Constructor Details
#initialize(documents, parser) ⇒ ProfileCollection
Returns a new instance of ProfileCollection.
23 24 25 26 |
# File 'lib/mongo/mongo.rb', line 23 def initialize(documents, parser) @documents = documents @parser = parser end |
Instance Method Details
#each ⇒ Object
28 29 30 31 32 33 |
# File 'lib/mongo/mongo.rb', line 28 def each @documents.each do |document| document['_id'] = generate_id yield @parser.parse(document) end end |
#get_last_document_date ⇒ Object
35 36 37 |
# File 'lib/mongo/mongo.rb', line 35 def get_last_document_date @documents[-1]['ts'] end |