lib/sucker_punch.rb in sucker_punch-0.1 vs lib/sucker_punch.rb in sucker_punch-0.2

- old
+ new

@@ -1,29 +1,25 @@ require 'celluloid' require 'sucker_punch/exceptions' +require 'sucker_punch/queue' +require 'sucker_punch/worker' +require 'sucker_punch/version' module SuckerPunch extend self def config(&block) instance_eval &block end def queue(options = {}) - raise SuckerPunch::MissingQueueName unless options[:name] - raise SuckerPunch::MissingWorkerName unless options[:worker] + raise MissingQueueName unless options[:name] + raise MissingWorkerName unless options[:worker] klass = options.fetch(:worker) registry_name = options.fetch(:name) size = options.fetch(:size, nil) - Celluloid::Actor[registry_name] = if size - klass.send(:pool, size: size) - else - klass.send(:pool) - end + q = Queue.new(registry_name) + q.register(klass, size) end -end - -require 'sucker_punch/queue' -require 'sucker_punch/worker' -require 'sucker_punch/version' +end \ No newline at end of file