phone_number_validator 0.8.8 → 0.8.9

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
  SHA256:
3
- metadata.gz: c015bf8d0e96bd9faa588d3baff72db7165c89a1dcc35600dbf989f6c750090f
4
- data.tar.gz: 07506f65d2e647966795047f98dacfa49d71583bf89391986e1630eda21149a3
3
+ metadata.gz: 36242588e708529ea4a6e7c1b0e55c42991376e0ad113db31a7b10ccaf7deced
4
+ data.tar.gz: 421db1abba9b5cccca06c1ff11d51ca7c8c7a04bfdb8c0b6f27554bf80a6fa3d
5
5
  SHA512:
6
- metadata.gz: 468b04060f8fddad221e0994c2659a355d19617a0968e39cddef4bea317da1c0922d5013a11aa70940009817a30c702e1d89af9eaa76f23eb85112a9a9cf0f76
7
- data.tar.gz: 5b0aa9700af0283e419e1375a7b89772f04008e713cb6f834c805b2057a3038564f286e63f2ea6a1710565e135228b1035b9725e458048a7a210171658c13a19
6
+ metadata.gz: c8a7ecb2b568428e7e16af7abab40286992c48fe8260a44466db14e41581a80add6b1a562540d88bcd59e3c0bc4de896fc726aca962804159bed8aec7b506770
7
+ data.tar.gz: 762fd726a559980cd5b834de7f59d589fc3e92267eddd93caeef82d75ec2864f51465560da3f9916bf0cc1e85d32766c5b2ff8cba47828d26e08b25ecb37d1b1
data/.gitignore CHANGED
@@ -1,26 +1,26 @@
1
- # System File(s)/Folder(s)
2
- .DS_Store
3
- Thumbs.db
4
- _MACOSX
5
-
6
- # Editor File(s)/Folder(s)
7
- *.code-workspace
8
- *.sublime-project
9
- *.sublime-workspace
10
- .vscode
11
- .idea
12
-
13
- # Generated Files
14
- *.gem
15
- *.lock
16
-
17
- # Executables
18
- *.bat
19
- *.sh:q
20
-
21
- # if gitignore is not working, try this:
22
- #
23
- # git rm -r --cached .
24
- # git add .
25
- # git commit -m "fixed untracked files"
26
- # git push
1
+ # System File(s)/Folder(s)
2
+ .DS_Store
3
+ Thumbs.db
4
+ _MACOSX
5
+
6
+ # Editor File(s)/Folder(s)
7
+ *.code-workspace
8
+ *.sublime-project
9
+ *.sublime-workspace
10
+ .vscode
11
+ .idea
12
+
13
+ # Generated Files
14
+ *.gem
15
+ *.lock
16
+
17
+ # Executables
18
+ *.bat
19
+ *.sh
20
+
21
+ # if gitignore is not working, try this:
22
+ #
23
+ # git rm -r --cached .
24
+ # git add .
25
+ # git commit -m "fixed untracked files"
26
+ # git push
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
- source 'https://rubygems.org'
2
- platform :ruby do
3
- gemspec
4
- gem 'rdoc', '~> 6.0', '>= 6.0.4'
5
- gem 'rake', '~> 11.2', '>= 11.2.2'
6
- end
1
+ source 'https://rubygems.org'
2
+ platform :ruby do
3
+ gemspec
4
+ gem 'rdoc', '~> 6.0', '>= 6.0.4'
5
+ gem 'rake', '~> 11.2', '>= 11.2.2'
6
+ end
data/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2018 bag33188
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2018 bag33188
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.rdoc CHANGED
@@ -1,59 +1,59 @@
1
- = Phone Number Validator
2
-
3
- == About
4
-
5
- This app is a US phone number-validating RubyGem.
6
-
7
- It uses a complex regular expression to validate any United States phone number.
8
-
9
- === Regular Expression
10
-
11
- This gem uses the following regular expression:
12
-
13
- # US Phone Numbers
14
- /^(?:(?:[2-9]11)|(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:\x20+|#|x\.?|ext\.?|extension)\s*(\d+))?)$/i
15
- # Regex Flags: i (ignore case)
16
-
17
- == Installing
18
-
19
- $ gem install phone_number_validator
20
-
21
- === Install Required Gems/Dependencies
22
-
23
- $ bundle install
24
-
25
- === Updating Required Gems/Dependencies
26
-
27
- $ bundle update
28
-
29
- == Uninstalling
30
-
31
- $ gem uninstall phone_number_validator
32
-
33
- == Testing
34
-
35
- $ rake test
36
-
37
- == Usage
38
-
39
- === In command line
40
-
41
- $ pnv "+1 (987) 654-3210 ext. 198842"
42
-
43
- ==== Output
44
-
45
- => true
46
-
47
- === In Ruby code
48
-
49
- require 'phone_number_validator'
50
-
51
- check_phone_number = PhoneNumberValidator.validate_phone_number('+1 (987) 654-3210 ext. 198842')
52
-
53
- print check_phone_number
54
-
55
- ==== Output
56
-
57
- => true
58
-
59
- Output can be <b>true</b> (<em>boolean, valid phone number</em>), <b>false</b> (<em>boolean, invalid phone number</em>), or <b>nil</b> (<em>symbol, no phone number entered</em>).
1
+ = Phone Number Validator
2
+
3
+ == About
4
+
5
+ This app is a US phone number-validating RubyGem.
6
+
7
+ It uses a complex regular expression to validate any United States phone number.
8
+
9
+ === Regular Expression
10
+
11
+ This gem uses the following regular expression:
12
+
13
+ # US Phone Numbers
14
+ /^(?:(?:[2-9]11)|(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:\x20+|#|x\.?|ext\.?|extension)\s*(\d+))?)$/i
15
+ # Regex Flags: i (ignore case)
16
+
17
+ == Installing
18
+
19
+ $ gem install phone_number_validator
20
+
21
+ === Install Required Gems/Dependencies
22
+
23
+ $ bundle install
24
+
25
+ === Updating Required Gems/Dependencies
26
+
27
+ $ bundle update
28
+
29
+ == Uninstalling
30
+
31
+ $ gem uninstall phone_number_validator
32
+
33
+ == Testing
34
+
35
+ $ rake test
36
+
37
+ == Usage
38
+
39
+ === In command line
40
+
41
+ $ pnv "+1 (987) 654-3210 ext. 198842"
42
+
43
+ ==== Output
44
+
45
+ => true
46
+
47
+ === In Ruby code
48
+
49
+ require 'phone_number_validator'
50
+
51
+ check_phone_number = PhoneNumberValidator.validate_phone_number('+1 (987) 654-3210 ext. 198842')
52
+
53
+ print check_phone_number
54
+
55
+ ==== Output
56
+
57
+ => true
58
+
59
+ Output can be <b>true</b> (<em>boolean, valid phone number</em>), <b>false</b> (<em>boolean, invalid phone number</em>), or <b>nil</b> (<em>symbol, no phone number entered</em>).
data/Rakefile CHANGED
@@ -1,26 +1,26 @@
1
- require 'rake/testtask'
2
- require 'rdoc/task'
3
-
4
- Rake::TestTask.new do |test|
5
- test.libs << 'test'
6
- end
7
-
8
- desc 'Run tests'
9
- task :default => :test
10
-
11
- RDoc::Task.new do |rdoc|
12
- rdoc.main = 'README.rdoc'
13
- rdoc.title = 'Phone Number Validator'
14
- rdoc.rdoc_dir = 'doc'
15
- rdoc.rdoc_files.include('README.rdoc', 'lib/*.rb', 'lib/**/*.rb', 'test/*.rb', 'bin/*')
16
- end
17
-
18
- # for Windows
19
- task :deldocw do
20
- `RMDIR /S /Q "doc"`
21
- end
22
-
23
- # for Unix
24
- task :deldocx do
25
- `rm -rf doc`
26
- end
1
+ require 'rake/testtask'
2
+ require 'rdoc/task'
3
+
4
+ Rake::TestTask.new do |test|
5
+ test.libs << 'test'
6
+ end
7
+
8
+ desc 'Run tests'
9
+ task :default => :test
10
+
11
+ RDoc::Task.new do |rdoc|
12
+ rdoc.main = 'README.rdoc'
13
+ rdoc.title = 'Phone Number Validator'
14
+ rdoc.rdoc_dir = 'doc'
15
+ rdoc.rdoc_files.include('README.rdoc', 'lib/*.rb', 'lib/**/*.rb', 'test/*.rb', 'bin/*')
16
+ end
17
+
18
+ # for Windows
19
+ task :deldocw do
20
+ `RMDIR /S /Q "doc"`
21
+ end
22
+
23
+ # for Unix
24
+ task :deldocx do
25
+ `rm -rf doc`
26
+ end
data/bin/pnv CHANGED
@@ -1,18 +1,18 @@
1
- #!/usr/bin/env ruby
2
-
3
- =begin
4
- |======================|
5
- | PhoneNumberValidator |
6
- |----------------------|
7
- | Made by: bag33188 |
8
- |======================|
9
- =end
10
-
11
- require 'phone_number_validator'
12
-
13
- if (ARGV[0] == nil)
14
- print "No phone number entered.\r\n"
15
- else
16
- # execute validator
17
- puts PhoneNumberValidator.validate(ARGV[0])
18
- end
1
+ #!/usr/bin/env ruby
2
+
3
+ =begin
4
+ |======================|
5
+ | PhoneNumberValidator |
6
+ |----------------------|
7
+ | Made by: bag33188 |
8
+ |======================|
9
+ =end
10
+
11
+ require 'phone_number_validator'
12
+
13
+ if (ARGV[0] == nil)
14
+ print "No phone number entered.\r\n"
15
+ else
16
+ # execute validator
17
+ puts PhoneNumberValidator.validate(ARGV[0])
18
+ end
@@ -1,160 +1,161 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta charset="UTF-8">
6
-
7
- <title>class PhoneNumberValidator - Phone Number Validator</title>
8
-
9
- <script type="text/javascript">
10
- var rdoc_rel_prefix = "./";
11
- var index_rel_prefix = "./";
12
- </script>
13
-
14
- <script src="./js/jquery.js"></script>
15
- <script src="./js/darkfish.js"></script>
16
-
17
- <link href="./css/fonts.css" rel="stylesheet">
18
- <link href="./css/rdoc.css" rel="stylesheet">
19
-
20
-
21
-
22
- <body id="top" role="document" class="class">
23
- <nav role="navigation">
24
- <div id="project-navigation">
25
- <div id="home-section" role="region" title="Quick navigation" class="nav-section">
26
- <h2>
27
- <a href="./index.html" rel="home">Home</a>
28
- </h2>
29
-
30
- <div id="table-of-contents-navigation">
31
- <a href="./table_of_contents.html#pages">Pages</a>
32
- <a href="./table_of_contents.html#classes">Classes</a>
33
- <a href="./table_of_contents.html#methods">Methods</a>
34
- </div>
35
- </div>
36
-
37
- <div id="search-section" role="search" class="project-section initially-hidden">
38
- <form action="#" method="get" accept-charset="utf-8">
39
- <div id="search-field-wrapper">
40
- <input id="search-field" role="combobox" aria-label="Search"
41
- aria-autocomplete="list" aria-controls="search-results"
42
- type="text" name="search" placeholder="Search" spellcheck="false"
43
- title="Type to search, Up and Down to navigate, Enter to load">
44
- </div>
45
-
46
- <ul id="search-results" aria-label="Search Results"
47
- aria-busy="false" aria-expanded="false"
48
- aria-atomic="false" class="initially-hidden"></ul>
49
- </form>
50
- </div>
51
-
52
- </div>
53
-
54
-
55
-
56
- <div id="class-metadata">
57
-
58
- <div id="parent-class-section" class="nav-section">
59
- <h3>Parent</h3>
60
-
61
-
62
- <p class="link">Object
63
-
64
- </div>
65
-
66
-
67
-
68
- <!-- Method Quickref -->
69
- <div id="method-list-section" class="nav-section">
70
- <h3>Methods</h3>
71
-
72
- <ul class="link-list" role="directory">
73
-
74
- <li ><a href="#method-c-validate">::validate</a>
75
-
76
- </ul>
77
- </div>
78
-
79
- </div>
80
- </nav>
81
-
82
- <main role="main" aria-labelledby="class-PhoneNumberValidator">
83
- <h1 id="class-PhoneNumberValidator" class="class">
84
- class PhoneNumberValidator
85
- </h1>
86
-
87
- <section class="description">
88
-
89
- <p>This class is the master/parent class to all of the validation
90
- functionality</p>
91
-
92
- </section>
93
-
94
-
95
- <section id="5Buntitled-5D" class="documentation-section">
96
-
97
-
98
-
99
-
100
-
101
-
102
-
103
-
104
-
105
- <section id="public-class-5Buntitled-5D-method-details" class="method-section">
106
- <header>
107
- <h3>Public Class Methods</h3>
108
- </header>
109
-
110
-
111
- <div id="method-c-validate" class="method-detail ">
112
-
113
- <div class="method-heading">
114
- <span class="method-name">validate</span><span
115
- class="method-args">(phone_number)</span>
116
-
117
- <span class="method-click-advice">click to toggle source</span>
118
-
119
- </div>
120
-
121
-
122
- <div class="method-description">
123
-
124
- <p>Validates any United States phone number!</p>
125
-
126
- <p><strong>Arguments:</strong></p>
127
-
128
- <pre>phone_number: (String)</pre>
129
-
130
-
131
-
132
-
133
- <div class="method-source-code" id="validate-source">
134
- <pre><span class="ruby-comment"># File lib/phone_number_validator.rb, line 11</span>
135
- <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">validate</span>(<span class="ruby-identifier">phone_number</span>)
136
- <span class="ruby-identifier">validator</span> = <span class="ruby-constant">Validator</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">phone_number</span>)
137
- <span class="ruby-identifier">validator</span>.<span class="ruby-identifier">validate</span>
138
- <span class="ruby-keyword">end</span></pre>
139
- </div>
140
-
141
- </div>
142
-
143
-
144
-
145
-
146
- </div>
147
-
148
-
149
- </section>
150
-
151
- </section>
152
- </main>
153
-
154
-
155
- <footer id="validator-badges" role="contentinfo">
156
- <p><a href="https://validator.w3.org/check/referer">Validate</a>
157
- <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.0.1.
158
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
159
- </footer>
160
-
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>class PhoneNumberValidator - Phone Number Validator</title>
8
+
9
+ <script type="text/javascript">
10
+ var rdoc_rel_prefix = "./";
11
+ var index_rel_prefix = "./";
12
+ </script>
13
+
14
+ <script src="./js/jquery.js"></script>
15
+ <script src="./js/darkfish.js"></script>
16
+
17
+ <link href="./css/fonts.css" rel="stylesheet">
18
+ <link href="./css/rdoc.css" rel="stylesheet">
19
+
20
+
21
+
22
+
23
+ <body id="top" role="document" class="class">
24
+ <nav role="navigation">
25
+ <div id="project-navigation">
26
+ <div id="home-section" role="region" title="Quick navigation" class="nav-section">
27
+ <h2>
28
+ <a href="./index.html" rel="home">Home</a>
29
+ </h2>
30
+
31
+ <div id="table-of-contents-navigation">
32
+ <a href="./table_of_contents.html#pages">Pages</a>
33
+ <a href="./table_of_contents.html#classes">Classes</a>
34
+ <a href="./table_of_contents.html#methods">Methods</a>
35
+ </div>
36
+ </div>
37
+
38
+ <div id="search-section" role="search" class="project-section initially-hidden">
39
+ <form action="#" method="get" accept-charset="utf-8">
40
+ <div id="search-field-wrapper">
41
+ <input id="search-field" role="combobox" aria-label="Search"
42
+ aria-autocomplete="list" aria-controls="search-results"
43
+ type="text" name="search" placeholder="Search" spellcheck="false"
44
+ title="Type to search, Up and Down to navigate, Enter to load">
45
+ </div>
46
+
47
+ <ul id="search-results" aria-label="Search Results"
48
+ aria-busy="false" aria-expanded="false"
49
+ aria-atomic="false" class="initially-hidden"></ul>
50
+ </form>
51
+ </div>
52
+
53
+ </div>
54
+
55
+
56
+
57
+ <div id="class-metadata">
58
+
59
+ <div id="parent-class-section" class="nav-section">
60
+ <h3>Parent</h3>
61
+
62
+
63
+ <p class="link">Object
64
+
65
+ </div>
66
+
67
+
68
+
69
+ <!-- Method Quickref -->
70
+ <div id="method-list-section" class="nav-section">
71
+ <h3>Methods</h3>
72
+
73
+ <ul class="link-list" role="directory">
74
+
75
+ <li ><a href="#method-c-validate">::validate</a>
76
+
77
+ </ul>
78
+ </div>
79
+
80
+ </div>
81
+ </nav>
82
+
83
+ <main role="main" aria-labelledby="class-PhoneNumberValidator">
84
+ <h1 id="class-PhoneNumberValidator" class="class">
85
+ class PhoneNumberValidator
86
+ </h1>
87
+
88
+ <section class="description">
89
+
90
+ <p>This class is the master/parent class to all of the validation functionality</p>
91
+
92
+ </section>
93
+
94
+
95
+ <section id="5Buntitled-5D" class="documentation-section">
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section">
106
+ <header>
107
+ <h3>Public Class Methods</h3>
108
+ </header>
109
+
110
+
111
+ <div id="method-c-validate" class="method-detail ">
112
+
113
+ <div class="method-heading">
114
+ <span class="method-name">validate</span><span
115
+ class="method-args">(phone_number)</span>
116
+
117
+ <span class="method-click-advice">click to toggle source</span>
118
+
119
+ </div>
120
+
121
+
122
+ <div class="method-description">
123
+
124
+ <p>Validates any United States phone number!</p>
125
+
126
+ <p><strong>Arguments:</strong></p>
127
+
128
+ <pre>phone_number: (String)</pre>
129
+
130
+
131
+
132
+
133
+ <div class="method-source-code" id="validate-source">
134
+ <pre><span class="ruby-comment"># File lib/phone_number_validator.rb, line 11</span>
135
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">validate</span>(<span class="ruby-identifier">phone_number</span>)
136
+ <span class="ruby-identifier">validator</span> = <span class="ruby-constant">Validator</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">phone_number</span>)
137
+ <span class="ruby-identifier">validator</span>.<span class="ruby-identifier">validate</span>
138
+ <span class="ruby-keyword">end</span></pre>
139
+ </div>
140
+
141
+ </div>
142
+
143
+
144
+
145
+
146
+ </div>
147
+
148
+
149
+ </section>
150
+
151
+ </section>
152
+
153
+ </main>
154
+
155
+
156
+ <footer id="validator-badges" role="contentinfo">
157
+ <p><a href="https://validator.w3.org/check/referer">Validate</a>
158
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.1.0.
159
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
160
+ </footer>
161
+