Module: RabbitJobs::Job::ClassMethods
- Defined in:
- lib/rabbit_jobs/job.rb
Instance Attribute Summary collapse
-
#rj_expires_in ⇒ Object
Returns the value of attribute rj_expires_in.
-
#rj_on_error_hooks ⇒ Object
Returns the value of attribute rj_on_error_hooks.
Instance Method Summary collapse
-
#expires_in(seconds) ⇒ Object
DSL method for jobs.
- #on_error(*hooks) ⇒ Object
Instance Attribute Details
#rj_expires_in ⇒ Object
Returns the value of attribute rj_expires_in.
92 93 94 |
# File 'lib/rabbit_jobs/job.rb', line 92 def rj_expires_in @rj_expires_in end |
#rj_on_error_hooks ⇒ Object
Returns the value of attribute rj_on_error_hooks.
92 93 94 |
# File 'lib/rabbit_jobs/job.rb', line 92 def rj_on_error_hooks @rj_on_error_hooks end |
Instance Method Details
#expires_in(seconds) ⇒ Object
DSL method for jobs
95 96 97 |
# File 'lib/rabbit_jobs/job.rb', line 95 def expires_in(seconds) @rj_expires_in = seconds.to_i end |
#on_error(*hooks) ⇒ Object
99 100 101 102 103 104 105 |
# File 'lib/rabbit_jobs/job.rb', line 99 def on_error(*hooks) hooks.each do |proc_or_symbol| raise ArgumentError unless proc_or_symbol && ( proc_or_symbol.is_a?(Proc) || proc_or_symbol.is_a?(Symbol) ) @rj_on_error_hooks ||= [] @rj_on_error_hooks << proc_or_symbol end end |