Module: Dbwatcher::Storage::DateHelper

Included in:
QueryStorage
Defined in:
lib/dbwatcher/storage/date_helper.rb

Constant Summary collapse

DEFAULT_CLEANUP_DAYS =
30

Instance Method Summary collapse

Instance Method Details

#cleanup_cutoff_date(days_to_keep = DEFAULT_CLEANUP_DAYS) ⇒ Object



12
13
14
# File 'lib/dbwatcher/storage/date_helper.rb', line 12

def cleanup_cutoff_date(days_to_keep = DEFAULT_CLEANUP_DAYS)
  Time.now - (days_to_keep * 24 * 60 * 60)
end

#date_file_path(base_path, date) ⇒ Object



16
17
18
# File 'lib/dbwatcher/storage/date_helper.rb', line 16

def date_file_path(base_path, date)
  File.join(base_path, "#{date}.json")
end

#format_date(timestamp) ⇒ Object



8
9
10
# File 'lib/dbwatcher/storage/date_helper.rb', line 8

def format_date(timestamp)
  timestamp.strftime("%Y-%m-%d")
end