def uri
      @uri = begin
        uri = ::URI.parse('amqp://localhost')

        uri.user     = CGI.escape(config[:user]) if config.key?(:user)
        uri.password = '****'                    if config.key?(:pass)
        uri.host     = config[:host]             if config.key?(:host)
        uri.port     = config[:port]             if config.key?(:port)
        uri.scheme   = config[:ssl] ? 'amqps' : 'amqp'

        if config.key?(:vhost) && config[:vhost] != '/'
          uri.path = "/#{CGI.escape(config[:vhost])}"
        end

        uri
      end
    end
def uri
      @uri = begin
        uri = ::URI.parse('amqp://localhost')

        uri.user     = CGI.escape(config[:user]) if config.key?(:user)
        uri.password = '****'                    if config.key?(:pass)
        uri.host     = config[:host]             if config.key?(:host)
        uri.port     = config[:port]             if config.key?(:port)
        uri.scheme   = config[:ssl] ? 'amqps' : 'amqp'

        if config.key?(:vhost) && config[:vhost] != '/'
          uri.path = "/#{CGI.escape(config[:vhost])}"
        end

        uri
      end
    end
rubocop:disable MethodLength
 rubocop:enable all
 rubocop:disable AbcSize
 rubocop:disable MethodLength
 rubocop:disable PerceivedComplexity
 rubocop:disable CyclomaticComplexity