class SidekiqScheduler::JobPresenter
Attributes
Public Class Methods
Source
# File lib/sidekiq-scheduler/job_presenter.rb, line 66 def self.build_collection(schedule_hash) schedule_hash ||= {} schedule_hash.sort.map do |name, job_spec| new(name, job_spec) end end
Builds the presenter instances for the schedule hash
@param schedule_hash [Hash] with the redis schedule @return [Array<JobPresenter>] an array with the instances of presenters
Source
# File lib/sidekiq-scheduler/job_presenter.rb, line 14 def initialize(name, attributes) @name = name @attributes = attributes end
Public Instance Methods
Source
# File lib/sidekiq-scheduler/job_presenter.rb, line 54 def [](key) @attributes[key] end
Delegates the :[] method to the attributes’ hash
@return [String] with the value for that key
Source
# File lib/sidekiq-scheduler/job_presenter.rb, line 58 def enabled? SidekiqScheduler::Scheduler.job_enabled?(@name) end
Source
# File lib/sidekiq-scheduler/job_presenter.rb, line 40 def interval @attributes['cron'] || @attributes['interval'] || @attributes['every'] || @attributes['at'] || @attributes['in'] end
Returns the interval for the job
@return [String] with the job’s interval
Source
# File lib/sidekiq-scheduler/job_presenter.rb, line 31 def last_time execution_time = SidekiqScheduler::RedisManager.get_job_last_time(name) relative_time(Time.parse(execution_time)) if execution_time end
Returns the last execution time for the job
@return [String] with the job’s last time
Source
# File lib/sidekiq-scheduler/job_presenter.rb, line 22 def next_time execution_time = SidekiqScheduler::RedisManager.get_job_next_time(name) relative_time(Time.parse(execution_time)) if execution_time end
Returns the next time execution for the job
@return [String] with the job’s next time
Source
# File lib/sidekiq-scheduler/job_presenter.rb, line 47 def queue @attributes.fetch('queue', 'default') end
Returns the queue of the job
@return [String] with the job’s queue