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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0f93de85b2acf9ac90257946858b149529856aca
4
- data.tar.gz: b0b149a39a1085f7608e9e7a87966f9a81682f2c
3
+ metadata.gz: 5fe998b83cee06143d40eca7c8d300b31adf3f9b
4
+ data.tar.gz: 01c4b0e9d360b665e412dcf953595b34f318e092
5
5
  SHA512:
6
- metadata.gz: fbebaa9fafad59da23ad9f1ed19efc759bd91b45720f48a7c5e3f5bce38c8799dd923ad5bdca21675d4a2065c92af446af061bc737353d79b1c6cd5144601c30
7
- data.tar.gz: fdf889314384b42e761c6f4e5607bdc6c152ba41b613bd5fa74deffd238499b8c81a7cb574fa57568f1c667f20441db7589430c50140b449a55346c351ca082e
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(attribute).kind_of?(URI::HTTP)
4
- url_format_invalid(record, attribute, value)
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
@@ -1,3 +1,3 @@
1
1
  module UrlFormat
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: url_format
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Otander