Class: Tartarus::ScheduleArchivingModel
- Inherits:
-
Object
- Object
- Tartarus::ScheduleArchivingModel
- Defined in:
- lib/tartarus/schedule_archiving_model.rb
Instance Method Summary collapse
-
#initialize(registry: Tartarus.registry) ⇒ ScheduleArchivingModel
constructor
A new instance of ScheduleArchivingModel.
- #schedule(archivable_item_name) ⇒ Object
Constructor Details
#initialize(registry: Tartarus.registry) ⇒ ScheduleArchivingModel
Returns a new instance of ScheduleArchivingModel.
5 6 7 |
# File 'lib/tartarus/schedule_archiving_model.rb', line 5 def initialize(registry: Tartarus.registry) @registry = registry end |
Instance Method Details
#schedule(archivable_item_name) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/tartarus/schedule_archiving_model.rb', line 9 def schedule(archivable_item_name) archivable_item = registry.find_by_name(archivable_item_name) if archivable_item.scope_by_tenant? each_tenant(archivable_item) do |tenant| enqueue(Tartarus::Sidekiq::ArchiveModelWithTenantJob, archivable_item.queue, archivable_item.name, tenant) end else enqueue(Tartarus::Sidekiq::ArchiveModelWithoutTenantJob, archivable_item.queue, archivable_item.name) end end |