lib/fluffle/server.rb in fluffle-0.0.3 vs lib/fluffle/server.rb in fluffle-0.1.0
- old
+ new
@@ -1,10 +1,8 @@
module Fluffle
class Server
- class << self
- attr_accessor :default_server
- end
+ include Connectable
attr_reader :connection, :handlers
def initialize(url: nil)
self.connect(url) if url
@@ -13,18 +11,11 @@
@queues = {}
self.class.default_server ||= self
end
- def connect(*args)
- self.stop if self.connected?
-
- @connection = Bunny.new *args
- @connection.start
- end
-
- def connected?
- @connection&.connected?
+ class << self
+ attr_accessor :default_server
end
def drain(queue: 'default', handler: nil, &block)
if handler && block
raise ArgumentError, 'Cannot provide both handler: and block'