validates_phone_format_of 2.0.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +2 -0
- data/.travis.yml +8 -0
- data/README.md +2 -2
- data/gemfiles/Gemfile.active_model_6_0 +5 -0
- data/gemfiles/Gemfile.active_model_6_1 +5 -0
- data/gemfiles/Gemfile.active_model_6_2 +5 -0
- data/gemfiles/Gemfile.active_model_7_0 +5 -0
- data/lib/validates_phone_format_of.rb +2 -2
- data/spec/validates_phone_format_of_spec.rb +1 -1
- data/validates_phone_format_of.gemspec +2 -1
- metadata +24 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d95a25f704075668e80dad65c4903488996b764b1a85e60e8d9a637e7f98bc78
|
4
|
+
data.tar.gz: 6c88e26d10508dfb05de2610d4acf89095f72e47299e02f3f89b1118e98fc98f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eba1ad5e95181fbe86f91777d2a0af98d68417ec518bd59051e8763f81c9f1fb9647325893c2e56064d9f94bd5fc9276385b1962097e0b17ca3f65489f2cb011
|
7
|
+
data.tar.gz: b0622962cd4bf44e9eff7b20c1ae58cfeda0c659f2373cb343e7e9a446de8a512fa29451f61cc240c0ad466090aa9916b9570e79dc38c72382154e9dacf6fefe
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -6,6 +6,10 @@ rvm:
|
|
6
6
|
- 2.4.0
|
7
7
|
- 2.5.0
|
8
8
|
- 2.6.0
|
9
|
+
- 2.7.0
|
10
|
+
- 3.0.0
|
11
|
+
- 3.1.0
|
12
|
+
- 3.2.0
|
9
13
|
- jruby
|
10
14
|
gemfile:
|
11
15
|
- gemfiles/Gemfile.active_model_3_1
|
@@ -16,5 +20,9 @@ gemfile:
|
|
16
20
|
- gemfiles/Gemfile.active_model_5_0
|
17
21
|
- gemfiles/Gemfile.active_model_5_1
|
18
22
|
- gemfiles/Gemfile.active_model_5_2
|
23
|
+
- gemfiles/Gemfile.active_model_6_0
|
24
|
+
- gemfiles/Gemfile.active_model_6_1
|
25
|
+
- gemfiles/Gemfile.active_model_6_2
|
26
|
+
- gemfiles/Gemfile.active_model_7_0
|
19
27
|
install: bundle install
|
20
28
|
script: bundle exec rspec
|
data/README.md
CHANGED
@@ -11,7 +11,7 @@ validates_phone_format_of is distributed as a gem, which is how it should be use
|
|
11
11
|
|
12
12
|
Include the gem in your Gemfile:
|
13
13
|
|
14
|
-
gem 'validates_phone_format_of', '~>
|
14
|
+
gem 'validates_phone_format_of', '~> 3.0'
|
15
15
|
|
16
16
|
## Usage
|
17
17
|
|
@@ -27,7 +27,7 @@ class User < ActiveRecord::Base
|
|
27
27
|
# Same thing as
|
28
28
|
validates_format_of :phone, with: ValidatesPhoneFormatOf::Regexp
|
29
29
|
# Or
|
30
|
-
validates_format_of :phone, with: /\A
|
30
|
+
validates_format_of :phone, with: /\A\+\d{1,15}\z/
|
31
31
|
|
32
32
|
end
|
33
33
|
```
|
@@ -1,14 +1,14 @@
|
|
1
1
|
require 'active_model'
|
2
2
|
|
3
3
|
module ValidatesPhoneFormatOf
|
4
|
-
Regexp = /\A
|
4
|
+
Regexp = /\A\+\d{1,15}\z/
|
5
5
|
end
|
6
6
|
|
7
7
|
module ActiveModel
|
8
8
|
module Validations
|
9
9
|
class PhoneFormatValidator < EachValidator
|
10
10
|
def validate_each(record, attribute, value)
|
11
|
-
record.errors.add(attribute, :invalid_phone, options.merge({:value => value})) if value.to_s !~ ValidatesPhoneFormatOf::Regexp
|
11
|
+
record.errors.add(attribute, :invalid_phone, **options.merge({:value => value})) if value.to_s !~ ValidatesPhoneFormatOf::Regexp
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -28,7 +28,7 @@ describe ValidatesPhoneFormatOf do
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
['test', '0000', '(312) 555-1212'].each do |phone|
|
31
|
+
['test', '0000', '(312) 555-1212', '3125551212'].each do |phone|
|
32
32
|
it "#{phone} is not valid" do
|
33
33
|
user = @user_class.new(phone)
|
34
34
|
expect(user.valid?).to_not be_truthy
|
@@ -2,7 +2,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = 'validates_phone_format_of'
|
5
|
-
spec.version = '
|
5
|
+
spec.version = '3.0.0'
|
6
6
|
spec.authors = ['Jonathan VUKOVICH-TRIBOUHARET']
|
7
7
|
spec.email = ['jonathan.tribouharet@gmail.com']
|
8
8
|
|
@@ -21,4 +21,5 @@ Gem::Specification.new do |spec|
|
|
21
21
|
|
22
22
|
spec.add_development_dependency 'bundler'
|
23
23
|
spec.add_development_dependency 'rake'
|
24
|
+
spec.add_development_dependency 'rspec', '~> 3.6'
|
24
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: validates_phone_format_of
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan VUKOVICH-TRIBOUHARET
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.6'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.6'
|
41
55
|
description: Validate phone numbers against E.164 format with this Ruby on Rails gem
|
42
56
|
email:
|
43
57
|
- jonathan.tribouharet@gmail.com
|
@@ -61,6 +75,10 @@ files:
|
|
61
75
|
- gemfiles/Gemfile.active_model_5_0
|
62
76
|
- gemfiles/Gemfile.active_model_5_1
|
63
77
|
- gemfiles/Gemfile.active_model_5_2
|
78
|
+
- gemfiles/Gemfile.active_model_6_0
|
79
|
+
- gemfiles/Gemfile.active_model_6_1
|
80
|
+
- gemfiles/Gemfile.active_model_6_2
|
81
|
+
- gemfiles/Gemfile.active_model_7_0
|
64
82
|
- lib/validates_phone_format_of.rb
|
65
83
|
- spec/validates_phone_format_of_spec.rb
|
66
84
|
- validates_phone_format_of.gemspec
|
@@ -68,7 +86,7 @@ homepage: https://github.com/jonathantribouharet/validates_phone_format_of
|
|
68
86
|
licenses:
|
69
87
|
- MIT
|
70
88
|
metadata: {}
|
71
|
-
post_install_message:
|
89
|
+
post_install_message:
|
72
90
|
rdoc_options: []
|
73
91
|
require_paths:
|
74
92
|
- lib
|
@@ -83,9 +101,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
101
|
- !ruby/object:Gem::Version
|
84
102
|
version: '0'
|
85
103
|
requirements: []
|
86
|
-
|
87
|
-
|
88
|
-
signing_key:
|
104
|
+
rubygems_version: 3.4.6
|
105
|
+
signing_key:
|
89
106
|
specification_version: 4
|
90
107
|
summary: Validate phone numbers against E.164 format with this Ruby on Rails gem
|
91
108
|
test_files: []
|