Class: Tally::ArchiverJob

Inherits:
ApplicationJob show all
Defined in:
app/jobs/tally/archiver_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(day = "today") ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'app/jobs/tally/archiver_job.rb', line 6

def perform(day = "today")
  case day.to_s
  when /^\d{4}-\d{2}-\d{2}$/
    Tally::Archiver.archive! day: Date.parse(day)
  when "yesterday"
    Tally::Archiver.archive! day: 1.day.ago.to_date
  else
    Tally::Archiver.archive!
  end
end