url_format 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/url_format/url_format_validator.rb +2 -6
- data/lib/url_format/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5fe998b83cee06143d40eca7c8d300b31adf3f9b
|
4
|
+
data.tar.gz: 01c4b0e9d360b665e412dcf953595b34f318e092
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78d21347e179ab750f7ef3edde1f8deee279a5f51812644e0e27ff8e22ebcb480fb14f5a7be11e3c59a5dc5617fa8f57aa062c91783d916ee05b89746a18d6f8
|
7
|
+
data.tar.gz: 61002189135f128dd3436cec6946c4d1ff79eba8b436d0d222471685e1053c50eac678cb4ba6b65838628d0d864ba5625e5e28d5cfd879462905452382be379f
|
@@ -1,13 +1,9 @@
|
|
1
1
|
class UrlFormatValidator < ActiveModel::EachValidator
|
2
2
|
def validate_each(record, attribute, value)
|
3
|
-
unless URI.parse(
|
4
|
-
|
3
|
+
unless URI.parse(value).kind_of?(URI::HTTP)
|
4
|
+
record.errors[attribute] << (options[:message] || "is invalid")
|
5
5
|
end
|
6
6
|
rescue URI::InvalidURIError
|
7
|
-
url_format_invalid(record, attribute, value)
|
8
|
-
end
|
9
|
-
|
10
|
-
def url_format_invalid(record, attribute, value)
|
11
7
|
record.errors[attribute] << (options[:message] || "is invalid")
|
12
8
|
end
|
13
9
|
end
|
data/lib/url_format/version.rb
CHANGED