Class: OpencJsonSchemaFormats::URIValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/openc_json_schema_formats.rb

Instance Method Summary collapse

Instance Method Details

#validate(record) ⇒ Object

Actually, this only checks http and https formats, so isn’t really for URIs



24
25
26
27
28
29
30
31
# File 'lib/openc_json_schema_formats.rb', line 24

def validate(record)
  begin
    uri = URI.parse(record)
    uri.kind_of?(URI::HTTP) || uri.kind_of?(URI::HTTPS)
  rescue URI::InvalidURIError
    false
  end
end