Sha256: dc787988266bac9de8226d549cfcca9f031ea62e71fd3af2ac12fb4bc6ea3e44

Contents?: true

Size: 477 Bytes

Versions: 2

Compression:

Stored size: 477 Bytes

Contents

require 'delayed_cron/cron_job'

module DelayedCron
  module Scheduling

    def schedule(klass, method_name, options)
      job = CronJob.new(options.merge(klass: klass, method_name: method_name))
      job.enqueue(processor)
    end

    def timing_opts(job)
      {
        interval: job[:interval] || default_interval,
        time_zone: job[:time_zone],
        precision: job[:precision],
        at: job[:at]
      }.select { |_, value| !value.nil? }
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
delayed_cron-0.2.11 lib/delayed_cron/scheduling.rb
delayed_cron-0.2.10 lib/delayed_cron/scheduling.rb