Class: ProfileCollection

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

Instance Method Summary collapse

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

#eachObject



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_dateObject



35
36
37
# File 'lib/mongo/mongo.rb', line 35

def get_last_document_date
  @documents[-1]['ts']
end