Class: Importo::SidekiqBatchAdapter
- Inherits:
-
Object
- Object
- Importo::SidekiqBatchAdapter
- Defined in:
- lib/importo/adapters/sidekiq_batch_adapter.rb
Defined Under Namespace
Modules: ImportJobIncludes
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#instance ⇒ Object
writeonly
Sets the attribute instance.
-
#properties ⇒ Object
Returns the value of attribute properties.
Class Method Summary collapse
Instance Method Summary collapse
- #add ⇒ Object
- #finished? ⇒ Boolean
-
#initialize ⇒ SidekiqBatchAdapter
constructor
A new instance of SidekiqBatchAdapter.
- #on_success(job) ⇒ Object
Constructor Details
#initialize ⇒ SidekiqBatchAdapter
Returns a new instance of SidekiqBatchAdapter.
19 20 21 |
# File 'lib/importo/adapters/sidekiq_batch_adapter.rb', line 19 def initialize @instance = Sidekiq::Batch.new end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
13 14 15 |
# File 'lib/importo/adapters/sidekiq_batch_adapter.rb', line 13 def description @description end |
#instance=(value) ⇒ Object (writeonly)
Sets the attribute instance
15 16 17 |
# File 'lib/importo/adapters/sidekiq_batch_adapter.rb', line 15 def instance=(value) @instance = value end |
#properties ⇒ Object
Returns the value of attribute properties.
14 15 16 |
# File 'lib/importo/adapters/sidekiq_batch_adapter.rb', line 14 def properties @properties end |
Class Method Details
Instance Method Details
#add ⇒ Object
27 28 29 30 31 |
# File 'lib/importo/adapters/sidekiq_batch_adapter.rb', line 27 def add @instance.jobs do yield end end |
#finished? ⇒ Boolean
33 34 35 36 |
# File 'lib/importo/adapters/sidekiq_batch_adapter.rb', line 33 def finished? status = Sidekiq::Batch::Status.new(@instance.bid) status.complete? end |
#on_success(job) ⇒ Object
23 24 25 |
# File 'lib/importo/adapters/sidekiq_batch_adapter.rb', line 23 def on_success(job) @instance.on(:complete, job.constantize, properties) end |