Class: Controller
- Inherits:
-
Object
- Object
- Controller
- Defined in:
- lib/mongo/mongo.rb
Instance Method Summary collapse
- #get_next_events ⇒ Object
-
#initialize(event, url, collection, limit, path) ⇒ Controller
constructor
A new instance of Controller.
Constructor Details
#initialize(event, url, collection, limit, path) ⇒ Controller
Returns a new instance of Controller.
82 83 84 85 86 87 |
# File 'lib/mongo/mongo.rb', line 82 def initialize(event, url, collection, limit, path) @mongo_accessor = MongoAccessor.new(url, collection) @last_value_store = LastValueStore.new(path, collection) @document_parser = DocumentParser.new(event) @limit = limit end |
Instance Method Details
#get_next_events ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/mongo/mongo.rb', line 89 def get_next_events last_date_value = @last_value_store.get_last_value if last_date_value == '' documents = @mongo_accessor.get_documents(@limit) else documents = @mongo_accessor.get_documents_by_ts(last_date_value, @limit) end profile_collection = ProfileCollection.new(documents, @document_parser) @last_value_store.save_last_value(profile_collection.get_last_document_date) profile_collection end |