validate_url 0.2.2 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 37ced518803ac2e3b29d306910e06b2753876924
4
- data.tar.gz: c6608d386a54466dc2a9eb4b79e4e136f2871c39
3
+ metadata.gz: 96f44ddca984d787f96ec16966b40dc93e3a6e99
4
+ data.tar.gz: 4c769029b3a14ce585a894fb6be20441faacfe73
5
5
  SHA512:
6
- metadata.gz: d16a1eaca6be89e93a268d1293e41fb7e571b18733b577d601502ed9f9579692f7429d6a167c30d449952ff2c2b52f14274997a6d7db10c334cc78cc2848411c
7
- data.tar.gz: ebef3f938ef9193e385d5ea9f8589deab1dc0d38e3c880016932df99e50f96b482324af826b7edde3f2de002952016f1e106402e45fcfa93d00427b9bbe9950d
6
+ metadata.gz: 161b331bf596ea903da5a4a57f4b1c8478bcf8e3a5532e97830a63476221465766153b6aa87eae8e7c3d105fd2aee1b01dc298f00e97a8c762b6d0a2e6972aa4
7
+ data.tar.gz: 4e4b02215f6245cdb3bb0aff2a979afddd3c0d31c91b3c407320a16137e2f69e49e6aa6385b22d8d8528539b707bd291ebb5b98aaba240811a338cc64c81d0a1
@@ -0,0 +1,4 @@
1
+ en:
2
+ errors:
3
+ messages:
4
+ url: is not a valid URL
@@ -0,0 +1,4 @@
1
+ it:
2
+ errors:
3
+ messages:
4
+ url: non è un URL valido.
@@ -1,5 +1,7 @@
1
1
  require 'addressable/uri'
2
2
  require 'active_model'
3
+ require 'active_support/i18n'
4
+ I18n.load_path << File.dirname(__FILE__) + '/locale/en.yml'
3
5
 
4
6
  module ActiveModel
5
7
  module Validations
@@ -7,7 +9,7 @@ module ActiveModel
7
9
 
8
10
  def initialize(options)
9
11
  options.reverse_merge!(:schemes => %w(http https))
10
- options.reverse_merge!(:message => "is not a valid URL")
12
+ options.reverse_merge!(:message => :url)
11
13
  super(options)
12
14
  end
13
15
 
@@ -15,7 +17,7 @@ module ActiveModel
15
17
  schemes = [*options.fetch(:schemes)].map(&:to_s)
16
18
  begin
17
19
  uri = Addressable::URI.parse(value)
18
- unless uri && schemes.include?(uri.scheme)
20
+ unless uri && uri.host && schemes.include?(uri.scheme)
19
21
  record.errors.add(attribute, options.fetch(:message), :value => value)
20
22
  end
21
23
  rescue Addressable::URI::InvalidURIError
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: validate_url
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tanel Suurhans
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-08 00:00:00.000000000 Z
12
+ date: 2014-11-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel
@@ -81,6 +81,8 @@ files:
81
81
  - README.md
82
82
  - init.rb
83
83
  - install.rb
84
+ - lib/locale/en.yml
85
+ - lib/locale/it.yml
84
86
  - lib/validate_url.rb
85
87
  homepage: http://github.com/perfectline/validates_url/tree/master
86
88
  licenses: []
@@ -106,3 +108,4 @@ signing_key:
106
108
  specification_version: 4
107
109
  summary: Library for validating urls in Rails.
108
110
  test_files: []
111
+ has_rdoc: