Sha256: f203bed78e3232d9a1111ca395d05690541622f1da8b0d49b804e43254a2fed5

Contents?: true

Size: 739 Bytes

Versions: 2

Compression:

Stored size: 739 Bytes

Contents

# frozen_string_literal: true

module MiniScheduler::Schedule
  def queue(value = nil)
    @queue = value.to_s if value
    @queue ||= "default"
  end

  def daily(options = nil)
    @daily = options if options
    @daily
  end

  def every(duration = nil)
    if duration
      @every = duration
      if manager = MiniScheduler::Manager.current[queue]
        manager.ensure_schedule!(self)
      end
    end
    @every
  end

  # schedule job independently on each host (looking at hostname)
  def per_host
    @per_host = true
  end

  def is_per_host
    @per_host
  end

  def schedule_info
    manager = MiniScheduler::Manager.without_runner
    manager.schedule_info self
  end

  def scheduled?
    !!@every || !!@daily
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mini_scheduler-0.18.0 lib/mini_scheduler/schedule.rb
mini_scheduler-0.17.0 lib/mini_scheduler/schedule.rb