def uri_from(url)
      # This will raise an InvalidURIError if the URL is very wrong. It will
      # still pass for strings like "foo", though.
      url = URI(url)

      # We need to check if the URL was either http://, https:// or ftp://,
      # because these are the only ones we can download from. open-uri will add
      # the #open method only to these ones, so this is a good check.
      raise Error, 'url was invalid' unless url.respond_to?(:open)

      url
    end
def uri_from(url)
      # This will raise an InvalidURIError if the URL is very wrong. It will
      # still pass for strings like "foo", though.
      url = URI(url)

      # We need to check if the URL was either http://, https:// or ftp://,
      # because these are the only ones we can download from. open-uri will add
      # the #open method only to these ones, so this is a good check.
      raise Error, 'url was invalid' unless url.respond_to?(:open)

      url
    end
Disabling :reek:ManualDispatch here because we don't control the URI API