class BatchProcessor::BatchDetails
Attributes
batch_id[R]
Public Class Methods
class_name_for_batch_id(batch_id)
click to toggle source
# File lib/batch_processor/batch_details.rb, line 36 def class_name_for_batch_id(batch_id) default_redis.hget(redis_key_for_batch_id(batch_id), "class_name") end
new(batch_id)
click to toggle source
Calls superclass method
# File lib/batch_processor/batch_details.rb, line 41 def initialize(batch_id) @batch_id = batch_id super redis_key: self.class.redis_key_for_batch_id(batch_id) end
redis_key_for_batch_id(batch_id)
click to toggle source
# File lib/batch_processor/batch_details.rb, line 32 def redis_key_for_batch_id(batch_id) "#{name}::#{batch_id}" end
Public Instance Methods
finished_jobs_count()
click to toggle source
# File lib/batch_processor/batch_details.rb, line 50 def finished_jobs_count sum_up(:successful_jobs_count, :failed_jobs_count, :canceled_jobs_count) end
total_jobs_count()
click to toggle source
# File lib/batch_processor/batch_details.rb, line 54 def total_jobs_count sum_up( :pending_jobs_count, :running_jobs_count, :successful_jobs_count, :failed_jobs_count, :canceled_jobs_count, :cleared_jobs_count, ) end
unfinished_jobs_count()
click to toggle source
# File lib/batch_processor/batch_details.rb, line 46 def unfinished_jobs_count sum_up(:pending_jobs_count, :running_jobs_count) end
Private Instance Methods
sum_up(*fields)
click to toggle source
# File lib/batch_processor/batch_details.rb, line 67 def sum_up(*fields) values_at(*fields).map(&:to_i).sum end