Class: SuperSpreader::SchedulerConfig
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from RedisModel
#default_values, #delete, #initialize, #persisted?, #save
Instance Attribute Details
#schedule=(value) ⇒ Object
Sets the attribute schedule
46
47
48
|
# File 'lib/super_spreader/scheduler_config.rb', line 46
def schedule=(value)
@schedule = value
end
|
Instance Method Details
#job_class ⇒ Object
48
49
50
|
# File 'lib/super_spreader/scheduler_config.rb', line 48
def job_class
job_class_name.constantize
end
|
#per_second ⇒ Object
64
65
66
|
# File 'lib/super_spreader/scheduler_config.rb', line 64
def per_second
schedule.on_peak? ? per_second_on_peak : per_second_off_peak
end
|
#spread_options ⇒ Object
56
57
58
59
60
61
62
|
# File 'lib/super_spreader/scheduler_config.rb', line 56
def spread_options
{
batch_size: batch_size,
duration: duration,
per_second: per_second
}
end
|
#super_spreader_config ⇒ Object
52
53
54
|
# File 'lib/super_spreader/scheduler_config.rb', line 52
def super_spreader_config
[job_class, job_class.super_spreader_model_class]
end
|