Class: Haku::Delayable::Delayed
- Inherits:
-
Object
- Object
- Haku::Delayable::Delayed
- Defined in:
- lib/haku/delayable.rb
Instance Method Summary collapse
- #call(params = {}) ⇒ Object
-
#initialize(service, options = {}) ⇒ Delayed
constructor
A new instance of Delayed.
Constructor Details
#initialize(service, options = {}) ⇒ Delayed
Returns a new instance of Delayed.
19 20 21 22 23 24 25 |
# File 'lib/haku/delayable.rb', line 19 def initialize(service, ={}) @service = service = .reverse_merge( job: "::Haku::Delayable::Job", queue: Haku.job_queue ) end |
Instance Method Details
#call(params = {}) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/haku/delayable.rb', line 27 def call(params={}) if job.present? && defined?(job) job.set().perform_later(@service, params) else @service.call(params) end end |