Class: MailSpy::ProcessLog
- Inherits:
-
Object
- Object
- MailSpy::ProcessLog
- Includes:
- Mongoid::Document, Mongoid::Timestamps
- Defined in:
- app/models/mail_spy/process_log.rb
Class Method Summary collapse
- .currently_processing? ⇒ Boolean
-
.delete_stale_logs(date = nil) ⇒ Object
Deletes logs after a given date if no date is given we default to logs that are older that 3 months.
Class Method Details
.currently_processing? ⇒ Boolean
13 14 15 |
# File 'app/models/mail_spy/process_log.rb', line 13 def self.currently_processing? self.where(:running => true).first.present? end |
.delete_stale_logs(date = nil) ⇒ Object
Deletes logs after a given date if no date is given we default to logs that are older that 3 months.
19 20 21 22 |
# File 'app/models/mail_spy/process_log.rb', line 19 def self.delete_stale_logs(date=nil) date = Time.now.advance(:months => -3) if date.nil? self.where("created_at < #{date}").delete_all end |