Sha256: 7253d33e221aaef54e12c41aeb5a297a22366f70ce1de59e45866ee87fda023c
Contents?: true
Size: 916 Bytes
Versions: 2
Compression:
Stored size: 916 Bytes
Contents
require 'background_worker/version' require 'background_worker/config' require 'background_worker/base' module BackgroundWorker # Configure worker # # eg: # BackgroundWorker.configure( # logger: Rails.logger, # enqueue_with: -> klass, method_name, opts { Resque.enqueue(klass, method_name, opts) }, # after_exception: -> e { Airbrake.notify(e) } # ) def self.configure(options) @config = Config.new(options) end def self.enqueue(klass, method_name, options) config.enqueue_with.call(klass, method_name, options) end def self.logger config.logger end def self.verify_active_connections! Rails.cache.reconnect if defined?(Rails) ActiveRecord::Base.verify_active_connections! if defined?(ActiveRecord) end def self.after_exception(e) config.after_exception(e) end def self.config fail 'Not configured!' unless @config @config end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
background_worker-0.0.5 | lib/background_worker.rb |
background_worker-0.0.4 | lib/background_worker.rb |