class RemoveBg::UrlValidator
Constants
- PERMITTED_SCHEMES
Public Class Methods
validate(url)
click to toggle source
# File lib/remove_bg/url_validator.rb, line 8 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