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.sort.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? SidekiqScheduler::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 last_time
-
(String)
- with the job's last time
def last_time execution_time = SidekiqScheduler::RedisManager.get_job_last_time(name) relative_time(Time.parse(execution_time)) if execution_time end
def next_time
-
(String)
- with the job's next time
def next_time execution_time = SidekiqScheduler::RedisManager.get_job_next_time(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