Class: Tartarus::Repository
- Inherits:
-
Object
- Object
- Tartarus::Repository
- Defined in:
- lib/tartarus/repository.rb
Instance Method Summary collapse
-
#initialize(backend: Sidekiq::Cron::Job, serializer: Tartarus::ArchivableItem::SidekiqCronJobSerializer.new) ⇒ Repository
constructor
A new instance of Repository.
- #save(archivable_item) ⇒ Object
Constructor Details
#initialize(backend: Sidekiq::Cron::Job, serializer: Tartarus::ArchivableItem::SidekiqCronJobSerializer.new) ⇒ Repository
Returns a new instance of Repository.
5 6 7 8 |
# File 'lib/tartarus/repository.rb', line 5 def initialize(backend: Sidekiq::Cron::Job, serializer: Tartarus::ArchivableItem::SidekiqCronJobSerializer.new) @backend = backend @serializer = serializer end |
Instance Method Details
#save(archivable_item) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/tartarus/repository.rb', line 10 def save(archivable_item) backend.new(serializer.serialize(archivable_item)).tap do |job| if job.valid? job.save else raise_invalid_job(job) end end end |