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.
20 21 22 |
# File 'lib/importo/adapters/sidekiq_batch_adapter.rb', line 20 def initialize @instance = Sidekiq::Batch.new end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
14 15 16 |
# File 'lib/importo/adapters/sidekiq_batch_adapter.rb', line 14 def description @description end |
#instance=(value) ⇒ Object (writeonly)
Sets the attribute instance
16 17 18 |
# File 'lib/importo/adapters/sidekiq_batch_adapter.rb', line 16 def instance=(value) @instance = value end |
#properties ⇒ Object
Returns the value of attribute properties.
15 16 17 |
# File 'lib/importo/adapters/sidekiq_batch_adapter.rb', line 15 def properties @properties end |
Class Method Details
.find(id) ⇒ Object
44 45 46 47 48 |
# File 'lib/importo/adapters/sidekiq_batch_adapter.rb', line 44 def find(id) instance = new instance.instance = Sidekiq::Batch.new(id) instance end |
.import_job_base_class ⇒ Object
40 41 42 |
# File 'lib/importo/adapters/sidekiq_batch_adapter.rb', line 40 def import_job_base_class Object end |
Instance Method Details
#add ⇒ Object
28 29 30 31 32 |
# File 'lib/importo/adapters/sidekiq_batch_adapter.rb', line 28 def add @instance.jobs do yield end end |
#finished? ⇒ Boolean
34 35 36 37 |
# File 'lib/importo/adapters/sidekiq_batch_adapter.rb', line 34 def finished? status = Sidekiq::Batch::Status.new( @instance.bid) status.complete? end |
#on_success(job) ⇒ Object
24 25 26 |
# File 'lib/importo/adapters/sidekiq_batch_adapter.rb', line 24 def on_success(job) @instance.on(:complete, job.constantize, properties) end |