Class: Bellbro::SidekiqUtils::Job
- Inherits:
-
Object
- Object
- Bellbro::SidekiqUtils::Job
- Defined in:
- lib/bellbro/sidekiq_utils.rb
Instance Attribute Summary collapse
-
#source ⇒ Object
Returns the value of attribute source.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(source) ⇒ Job
constructor
A new instance of Job.
- #jid ⇒ Object
- #method_missing(method_name, *args, &block) ⇒ Object
Constructor Details
#initialize(source) ⇒ Job
Returns a new instance of Job.
33 34 35 |
# File 'lib/bellbro/sidekiq_utils.rb', line 33 def initialize(source) @source = source end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
37 38 39 |
# File 'lib/bellbro/sidekiq_utils.rb', line 37 def method_missing(method_name, *args, &block) source.args.first.try(:[], method_name.to_s) end |
Instance Attribute Details
#source ⇒ Object
Returns the value of attribute source.
31 32 33 |
# File 'lib/bellbro/sidekiq_utils.rb', line 31 def source @source end |
Class Method Details
.all_for_class(klass_name) ⇒ Object
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/bellbro/sidekiq_utils.rb', line 45 def self.all_for_class(klass_name) Retryable.retryable(on: Redis::TimeoutError) do Queue.all.map do |q| q.map do |job| next unless job.klass == klass_name new(job) end end.flatten.compact end end |
Instance Method Details
#jid ⇒ Object
41 42 43 |
# File 'lib/bellbro/sidekiq_utils.rb', line 41 def jid source.jid end |