class Quandl::Client::Base::Validation::UrlValidator

Public Instance Methods

validate_each(record, attribute, value) click to toggle source
# File lib/quandl/client/base/validation.rb, line 88
def validate_each(record, attribute, value)
  begin
    uri = URI.parse(value)
    resp = uri.kind_of?(URI::HTTP)

  rescue URI::InvalidURIError
    resp = false
  end
  unless resp == true
    record.errors[attribute] << (options[:message] || "is not an url")
  end
end