Module: Sentry::Sidekiq::Cron::Helpers

Defined in:
lib/sentry/sidekiq/cron/helpers.rb

Class Method Summary collapse

Class Method Details

.monitor_config(cron) ⇒ Object

This is used by Cron::Job and Scheduler



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/sentry/sidekiq/cron/helpers.rb', line 8

def self.monitor_config(cron)
  cron_parts = cron.strip.split(" ")

  if cron_parts.length > 5
    timezone = cron_parts.pop
    cron_without_timezone = cron_parts.join(" ")

    Sentry::Cron::MonitorConfig.from_crontab(cron_without_timezone, timezone: timezone)
  else
    Sentry::Cron::MonitorConfig.from_crontab(cron)
  end
end