Sha256: af6b2b9a2b19de1f3c8060b16e48af1fe020597b689b3f00e5441facf0d7e2f1
Contents?: true
Size: 416 Bytes
Versions: 8
Compression:
Stored size: 416 Bytes
Contents
require "uri" require_relative "error" module RemoveBg class UrlValidator PERMITTED_SCHEMES = ["http", "https"].freeze def self.validate(url) parsed = URI.parse(url) unless parsed.absolute? && PERMITTED_SCHEMES.include?(parsed.scheme) raise RemoveBg::InvalidUrlError.new(url) end rescue URI::InvalidURIError raise RemoveBg::InvalidUrlError.new(url) end end end
Version data entries
8 entries across 8 versions & 1 rubygems