validate_url 1.0.0 → 1.0.2
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 +4 -4
- data/README.md +3 -0
- data/lib/locale/de.yml +4 -0
- data/lib/locale/ja.yml +4 -0
- data/lib/locale/pt-BR.yml +4 -0
- data/lib/locale/tr.yml +4 -0
- data/lib/validate_url.rb +5 -1
- metadata +11 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a9370dd3549d270bff452c951a9de3ae4d0288b
|
4
|
+
data.tar.gz: 342adc16d0211b47d822d590f0395aa53ea74b8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce037a673542945b111562d32cb1633dfcc955fa5a256ad16823b2094da17d8715fa28b9a4bf252ceb0809f52d88e797c3534a7f0f88d5a0c30e3024b8da3538
|
7
|
+
data.tar.gz: 702b42045a2f850bcc2f5595299177ce97171caa05ca0a4732d78f7ec5b9c81c83b84c700e0a2605c870ff175bbf60232871e04b3b3c7db2ec6735089fd7cebc
|
data/README.md
CHANGED
data/lib/locale/de.yml
ADDED
data/lib/locale/ja.yml
ADDED
data/lib/locale/tr.yml
ADDED
data/lib/validate_url.rb
CHANGED
@@ -2,6 +2,8 @@ require 'addressable/uri'
|
|
2
2
|
require 'active_model'
|
3
3
|
require 'active_support/i18n'
|
4
4
|
I18n.load_path << File.dirname(__FILE__) + '/locale/en.yml'
|
5
|
+
I18n.load_path << File.dirname(__FILE__) + '/locale/tr.yml'
|
6
|
+
I18n.load_path << File.dirname(__FILE__) + '/locale/ja.yml'
|
5
7
|
|
6
8
|
module ActiveModel
|
7
9
|
module Validations
|
@@ -10,6 +12,8 @@ module ActiveModel
|
|
10
12
|
def initialize(options)
|
11
13
|
options.reverse_merge!(:schemes => %w(http https))
|
12
14
|
options.reverse_merge!(:message => :url)
|
15
|
+
options.reverse_merge!(:no_local => false)
|
16
|
+
|
13
17
|
super(options)
|
14
18
|
end
|
15
19
|
|
@@ -17,7 +21,7 @@ module ActiveModel
|
|
17
21
|
schemes = [*options.fetch(:schemes)].map(&:to_s)
|
18
22
|
begin
|
19
23
|
uri = Addressable::URI.parse(value)
|
20
|
-
unless uri && uri.host && schemes.include?(uri.scheme)
|
24
|
+
unless uri && uri.host && schemes.include?(uri.scheme) && (!options.fetch(:no_local) || uri.host.include?('.'))
|
21
25
|
record.errors.add(attribute, options.fetch(:message), :value => value)
|
22
26
|
end
|
23
27
|
rescue Addressable::URI::InvalidURIError
|
metadata
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: validate_url
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tanel Suurhans
|
8
8
|
- Tarmo Lehtpuu
|
9
|
+
- Vladimir Krylov
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date:
|
13
|
+
date: 2015-07-21 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: activemodel
|
@@ -69,8 +70,9 @@ dependencies:
|
|
69
70
|
version: 1.1.2
|
70
71
|
description: Library for validating urls in Rails.
|
71
72
|
email:
|
72
|
-
- tanel.suurhans@perfectline.
|
73
|
-
- tarmo.lehtpuu@perfectline.
|
73
|
+
- tanel.suurhans@perfectline.co
|
74
|
+
- tarmo.lehtpuu@perfectline.co
|
75
|
+
- vladimir.krylov@perfectline.co
|
74
76
|
executables: []
|
75
77
|
extensions: []
|
76
78
|
extra_rdoc_files:
|
@@ -81,8 +83,12 @@ files:
|
|
81
83
|
- README.md
|
82
84
|
- init.rb
|
83
85
|
- install.rb
|
86
|
+
- lib/locale/de.yml
|
84
87
|
- lib/locale/en.yml
|
85
88
|
- lib/locale/it.yml
|
89
|
+
- lib/locale/ja.yml
|
90
|
+
- lib/locale/pt-BR.yml
|
91
|
+
- lib/locale/tr.yml
|
86
92
|
- lib/validate_url.rb
|
87
93
|
homepage: http://github.com/perfectline/validates_url/tree/master
|
88
94
|
licenses: []
|
@@ -103,9 +109,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
109
|
version: '0'
|
104
110
|
requirements: []
|
105
111
|
rubyforge_project:
|
106
|
-
rubygems_version: 2.
|
112
|
+
rubygems_version: 2.4.5
|
107
113
|
signing_key:
|
108
114
|
specification_version: 4
|
109
115
|
summary: Library for validating urls in Rails.
|
110
116
|
test_files: []
|
111
|
-
has_rdoc:
|