Sha256: 49a126b262937a98a9c63a72bb26c6fcef9cae85ec902a88cf568896e991a175

Contents?: true

Size: 754 Bytes

Versions: 9

Compression:

Stored size: 754 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)
    if options
      @daily = options
    end
    @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

9 entries across 9 versions & 1 rubygems

Version Path
mini_scheduler-0.16.0 lib/mini_scheduler/schedule.rb
mini_scheduler-0.15.0 lib/mini_scheduler/schedule.rb
mini_scheduler-0.14.0 lib/mini_scheduler/schedule.rb
mini_scheduler-0.13.0 lib/mini_scheduler/schedule.rb
mini_scheduler-0.12.3 lib/mini_scheduler/schedule.rb
mini_scheduler-0.12.2 lib/mini_scheduler/schedule.rb
mini_scheduler-0.12.1 lib/mini_scheduler/schedule.rb
mini_scheduler-0.12.0 lib/mini_scheduler/schedule.rb
mini_scheduler-0.11.0 lib/mini_scheduler/schedule.rb