lib/message_driver/broker.rb in message-driver-0.3.0 vs lib/message_driver/broker.rb in message-driver-0.4.0
- old
+ new
@@ -25,11 +25,11 @@
end
result
end
def client(name)
- unless result = clients[name]
+ unless (result = clients[name])
result = clients[name] = Client.for_broker(name)
end
result
end
@@ -61,10 +61,11 @@
end
brokers.clear
end
private
+
def brokers
@brokers ||= { }
end
def clients
@@ -83,11 +84,11 @@
@adapter = resolve_adapter(options[:adapter], options)
@stopped = false
@configuration = options
@destinations = {}
@consumers = {}
- logger.debug "MessageDriver configured successfully!"
+ logger.debug 'MessageDriver configured successfully!'
end
def logger
MessageDriver.logger
end
@@ -121,11 +122,11 @@
dest = self.dynamic_destination(dest_name, dest_options, message_props)
@destinations[key] = dest
end
def consumer(key, &block)
- raise MessageDriver::Error, "you must provide a block" unless block_given?
+ raise MessageDriver::Error, 'you must provide a block' unless block_given?
@consumers[key] = block
end
def find_destination(destination_name)
destination = @destinations[destination_name]
@@ -142,10 +143,10 @@
private
def resolve_adapter(adapter, options)
case adapter
when nil
- raise "you must specify an adapter"
+ raise 'you must specify an adapter'
when Symbol, String
resolve_adapter(find_adapter_class(adapter), options)
when Class
resolve_adapter(adapter.new(self, options), options)
when MessageDriver::Adapters::Base