class Thumbtack::Types::URL
Handles validation of URL
values as supported by Pinboard
@api private
Constants
- VALID_SCHEMES
Valid
URL
schemes
Public Class Methods
validate(value)
click to toggle source
Validate a URL
@param [String] value
the URL to validate
@return [self]
@raise [Types::ValidationError]
if the URL's scheme isn't one of http, https, javascript, mailto, ftp, file, or feed
# File lib/thumbtack/types/url.rb, line 22 def self.validate(value) unless VALID_SCHEMES.include? URI(value).scheme raise ValidationError, "scheme must be one of #{VALID_SCHEMES.join(', ')}" end self end