def parse(uri)
      # Legacy parsing of URI configuration; does not follow usual
      # AMQP vhost encoding but used regular URL path
      uri = ::URI.parse(uri)

      config = {}
      config[:user]  ||= uri.user     if uri.user
      config[:pass]  ||= uri.password if uri.password
      config[:host]  ||= uri.host     if uri.host
      config[:port]  ||= uri.port     if uri.port
      config[:vhost] ||= uri.path     unless uri.path.empty?
      config[:ssl]   ||= uri.scheme.casecmp('amqps').zero?

      config
    end
def parse(uri)
      # Legacy parsing of URI configuration; does not follow usual
      # AMQP vhost encoding but used regular URL path
      uri = ::URI.parse(uri)

      config = {}
      config[:user]  ||= uri.user     if uri.user
      config[:pass]  ||= uri.password if uri.password
      config[:host]  ||= uri.host     if uri.host
      config[:port]  ||= uri.port     if uri.port
      config[:vhost] ||= uri.path     unless uri.path.empty?
      config[:ssl]   ||= uri.scheme.casecmp('amqps').zero?

      config
    end
rubocop:disable AbcSize