lib/message_driver/client.rb in message-driver-0.6.1 vs lib/message_driver/client.rb in message-driver-0.7.0
- old
+ new
@@ -19,11 +19,11 @@
# MesageDriver::Client.find_destination(:my_queue)
# end
# end
module Client
include Logging
- extend self
+ extend self # rubocop:disable Style/ModuleFunction
# @!group Defining and Looking up Destinations
def dynamic_destination(dest_name, dest_options = {}, message_props = {})
current_adapter_context.create_destination(dest_name, dest_options, message_props)
@@ -76,11 +76,11 @@
def nack_message(message, options = {})
message.nack(options)
end
def subscribe(destination_name, consumer_name, options = {})
- consumer = find_consumer(consumer_name)
+ consumer = find_consumer(consumer_name)
subscribe_with(destination_name, options, &consumer)
end
def subscribe_with(destination_name, options = {}, &consumer)
destination = find_destination(destination_name)
@@ -184,14 +184,10 @@
private
def fetch_context_wrapper(initialize = true)
wrapper = Thread.current[adapter_context_key]
if wrapper.nil? || !wrapper.valid?
- if initialize
- wrapper = build_context_wrapper
- else
- wrapper = nil
- end
+ wrapper = (build_context_wrapper if initialize)
Thread.current[adapter_context_key] = wrapper
end
wrapper
end