url_format 0.0.6 → 0.0.7
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 -2
- 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: a9ab1011a61bbac549072914ab54f74cefff6ad7
|
4
|
+
data.tar.gz: 88d1ed28e9763fa531589fded708b0a311b7f844
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 342caa41756703d9f1578a9b622f2bcfa4b5ade5324014aed5a9cc461da80186072df13d295f9697ab398044f82183346154dd7968f0172961cc591da9b5982b
|
7
|
+
data.tar.gz: 45a42f051194e50f89c760759cbed46bd1b38dedd458202482b41c426e05241c6606ec42c85d1069a2e73ea3e2ffe2774e94881b82663da39f82adf1d5fa9a33
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class UrlFormatValidator < ActiveModel::EachValidator
|
2
2
|
def validate_each(record, attribute, value)
|
3
|
-
format_value(value)
|
3
|
+
format_value(record, attribute, value)
|
4
4
|
unless URI.parse(value).kind_of?(URI::HTTP) && value =~ url_regexp
|
5
5
|
record.errors[attribute] << (options[:message] || "is invalid")
|
6
6
|
end
|
@@ -8,7 +8,7 @@ class UrlFormatValidator < ActiveModel::EachValidator
|
|
8
8
|
record.errors[attribute] << (options[:message] || "is invalid")
|
9
9
|
end
|
10
10
|
|
11
|
-
def format_value(value)
|
11
|
+
def format_value(record, attribute, value)
|
12
12
|
record.send("#{attribute}=","http://#{value}") unless value =~ /\Ahttps?:\/\//
|
13
13
|
end
|
14
14
|
|
data/lib/url_format/version.rb
CHANGED