Class: SidekiqScheduler::RufusUtils

Inherits:
Object
  • Object
show all
Defined in:
lib/sidekiq-scheduler/rufus_utils.rb

Class Method Summary collapse

Class Method Details

.normalize_schedule_options(options) ⇒ Array

Normalizes schedule options to rufust scheduler options

Examples:

normalize_schedule_options('15m') => ['15m', {}]
normalize_schedule_options(['15m']) => ['15m', {}]
normalize_schedule_options(['15m', first_in: '5m']) => ['15m', { first_in: '5m' }]

Parameters:

  • options (String, [Array])

    ptions [String, [Array]

Returns:

  • (Array)

16
17
18
19
20
21
22
23
24
25
26
# File 'lib/sidekiq-scheduler/rufus_utils.rb', line 16

def self.normalize_schedule_options(options)
  schedule, opts = options

  if !opts.is_a?(Hash)
    opts = {}
  end

  opts = SidekiqScheduler::Utils.symbolize_keys(opts)

  return schedule, opts
end