Module: Rabbithole
- Defined in:
- lib/rabbithole.rb,
lib/rabbithole/cli.rb,
lib/rabbithole/errors.rb,
lib/rabbithole/worker.rb,
lib/rabbithole/version.rb,
lib/rabbithole/connection.rb,
lib/rabbithole/error_handler.rb,
lib/rabbithole/error_handlers/null_handler.rb,
lib/rabbithole/error_handlers/raise_handler.rb
Defined Under Namespace
Modules: ErrorHandlers Classes: CLI, Connection, ErrorHandler, InvalidJobError, RabbitholeError, UnknownJobError, Worker
Constant Summary collapse
- VERSION_MAJOR =
0
- VERSION_MINOR =
0
- VERSION_RELEASE =
3
- VERSION =
[VERSION_MAJOR, VERSION_MINOR, VERSION_RELEASE].collect(&:to_s).join('.').freeze
Class Method Summary collapse
Class Method Details
.enqueue(klass, *args) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/rabbithole.rb', line 15 def self.enqueue(klass, *args) if klass.is_a?(Class) if klass.respond_to?(:perform) payload = { :klass => klass.to_s, :args => args }.to_msgpack queue = klass.instance_variable_defined?(:@queue) ? klass.instance_variable_get(:@queue) : Connection::DEFAULT_QUEUE Connection.publish(queue, payload) else raise InvalidJobError.new("The class #{klass} does not define the method perform. I don't know how to execute it...") end else raise UnknownJobError.new("The class #{klass} is not known to Rabbithole. Is it a class?") end end |