def opts_from_non_params(url)
      {}.tap do |o|
        o[:host]     = url.host        if url.host
        o[:port]     = url.port        if url.port
        o[:username] = url.user        if url.user
        o[:password] = url.password    if url.password
        o[:database] = url.path[1..-1] if url.path.length > 1
        o[:use_ssl]  = url.scheme == "https".freeze

        o[:udp] = { host: o[:host], port: o[:port] } if url.scheme == "udp"
      end
    end
def opts_from_non_params(url)
      {}.tap do |o|
        o[:host]     = url.host        if url.host
        o[:port]     = url.port        if url.port
        o[:username] = url.user        if url.user
        o[:password] = url.password    if url.password
        o[:database] = url.path[1..-1] if url.path.length > 1
        o[:use_ssl]  = url.scheme == "https".freeze

        o[:udp] = { host: o[:host], port: o[:port] } if url.scheme == "udp"
      end
    end
rubocop:disable Metrics/AbcSize
 rubocop:disable Metrics/CyclomaticComplexity