Sha256: b1f37e9e268d4c125089a04c69e0426eac457fc680a7fa76ff8bc14516e30d4b
Contents?: true
Size: 757 Bytes
Versions: 9
Compression:
Stored size: 757 Bytes
Contents
# vim:fileencoding=utf-8 module ResqueAdmin module Scheduler module Plugin def self.hooks(job, pattern) job.methods.grep(/^#{pattern}/).sort end def self.run_hooks(job, pattern, *args) results = hooks(job, pattern).map do |hook| job.send(hook, *args) end results.all? { |result| result != false } end def self.run_before_delayed_enqueue_hooks(klass, *args) run_hooks(klass, 'before_delayed_enqueue', *args) end def self.run_before_schedule_hooks(klass, *args) run_hooks(klass, 'before_schedule', *args) end def self.run_after_schedule_hooks(klass, *args) run_hooks(klass, 'after_schedule', *args) end end end end
Version data entries
9 entries across 9 versions & 2 rubygems