class SidekiqScheduler::JobPresenter
def self.build_collection(schedule_hash)
-
(Array
- an array with the instances of presenters)
Parameters:
-
schedule_hash
(Hash
) -- with the redis schedule
def self.build_collection(schedule_hash) schedule_hash ||= {} schedule_hash.map do |name, job_spec| new(name, job_spec) end end
def [](key)
-
(String)
- with the value for that key
def [](key) @attributes[key] end
def enabled?
def enabled? Sidekiq::Scheduler.job_enabled?(@name) end
def initialize(name, attributes)
def initialize(name, attributes) @name = name @attributes = attributes end
def interval
-
(String)
- with the job's interval
def interval @attributes['cron'] || @attributes['interval'] || @attributes['every'] end
def next_time
-
(String)
- with the job's next time
def next_time execution_time = Sidekiq.redis { |r| r.hget(Sidekiq::Scheduler.next_times_key, name) } relative_time(Time.parse(execution_time)) if execution_time end
def queue
-
(String)
- with the job's queue
def queue @attributes.fetch('queue', 'default') end