phone_number_validator 0.9.2 → 0.9.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
- SHA256:
3
- metadata.gz: 58c91975e85a514b4f8d29af0af9ae1f9705970d4d04366690e37f2cc92d65ae
4
- data.tar.gz: aced91444597682a8f0614d7c4e0711b746c897d9b897d5ff6756932fd017636
2
+ SHA1:
3
+ metadata.gz: ec0f6682110705b7bbb4a74b76084d79220cc6f3
4
+ data.tar.gz: b26d85196e15e9b6abbf4f1491dd817e5630956e
5
5
  SHA512:
6
- metadata.gz: 28aa3176824a42fc633526752705f25014b41ab4aeab2f71ec424b81360be5915d8f9fbaa3787d3525547ad526cf088c657efcbdaf4a6d8df5c397692c593ff2
7
- data.tar.gz: 74d41c09685963f5a2ce91927454fcae800511a458a82319e9334f73b3d0c229f994aee4df4eb593c74c1cbb6975c1e4438548d5028a30a1791c1ff2cbd9e605
6
+ metadata.gz: bf727fc8a574b7cfe8a901e7df8b6be37074721da19570a295b509be91701fb1f1f5f59ebc2527b0f29f4da71aa05004f5350e4c83ea8d2dc11c2278eaef4c74
7
+ data.tar.gz: 43f8e32543b9bd4a98d15934f54f7163446bcd4e3a490abfc61014149b192097c7b2082c595a9d044684ab01b1a5f977114d5af43718306e8e96773555c74e0d
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
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,66 +1,66 @@
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>).
60
-
61
- == Development
62
-
63
- Run the following to make +bin/pnv+ executable (Unix only):
64
-
65
- chmod ugo+x bin/pnv
66
-
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>).
60
+
61
+ == Development
62
+
63
+ Run the following to make +bin/pnv+ executable (Unix only):
64
+
65
+ chmod ugo+x bin/pnv
66
+
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,161 +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
-
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
-
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
+ </script>
12
+
13
+ <script src="./js/jquery.js"></script>
14
+ <script src="./js/darkfish.js"></script>
15
+
16
+ <link href="./css/fonts.css" rel="stylesheet">
17
+ <link href="./css/rdoc.css" rel="stylesheet">
18
+
19
+
20
+
21
+ <body id="top" role="document" class="class">
22
+ <nav role="navigation">
23
+ <div id="project-navigation">
24
+ <div id="home-section" role="region" title="Quick navigation" class="nav-section">
25
+ <h2>
26
+ <a href="./index.html" rel="home">Home</a>
27
+ </h2>
28
+
29
+ <div id="table-of-contents-navigation">
30
+ <a href="./table_of_contents.html#pages">Pages</a>
31
+ <a href="./table_of_contents.html#classes">Classes</a>
32
+ <a href="./table_of_contents.html#methods">Methods</a>
33
+ </div>
34
+ </div>
35
+
36
+ <div id="search-section" role="search" class="project-section initially-hidden">
37
+ <form action="#" method="get" accept-charset="utf-8">
38
+ <div id="search-field-wrapper">
39
+ <input id="search-field" role="combobox" aria-label="Search"
40
+ aria-autocomplete="list" aria-controls="search-results"
41
+ type="text" name="search" placeholder="Search" spellcheck="false"
42
+ title="Type to search, Up and Down to navigate, Enter to load">
43
+ </div>
44
+
45
+ <ul id="search-results" aria-label="Search Results"
46
+ aria-busy="false" aria-expanded="false"
47
+ aria-atomic="false" class="initially-hidden"></ul>
48
+ </form>
49
+ </div>
50
+
51
+ </div>
52
+
53
+
54
+
55
+ <div id="class-metadata">
56
+
57
+ <div id="parent-class-section" class="nav-section">
58
+ <h3>Parent</h3>
59
+
60
+
61
+ <p class="link">Object
62
+
63
+ </div>
64
+
65
+
66
+
67
+ <!-- Method Quickref -->
68
+ <div id="method-list-section" class="nav-section">
69
+ <h3>Methods</h3>
70
+
71
+ <ul class="link-list" role="directory">
72
+
73
+ <li ><a href="#method-c-validate">::validate</a>
74
+
75
+ </ul>
76
+ </div>
77
+
78
+ </div>
79
+ </nav>
80
+
81
+ <main role="main" aria-labelledby="class-PhoneNumberValidator">
82
+ <h1 id="class-PhoneNumberValidator" class="class">
83
+ class PhoneNumberValidator
84
+ </h1>
85
+
86
+ <section class="description">
87
+
88
+ <p>This class is the master/parent class to all of the validation
89
+ functionality</p>
90
+
91
+ </section>
92
+
93
+
94
+
95
+
96
+ <section id="5Buntitled-5D" class="documentation-section">
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section">
107
+ <header>
108
+ <h3>Public Class Methods</h3>
109
+ </header>
110
+
111
+
112
+ <div id="method-c-validate" class="method-detail ">
113
+
114
+ <div class="method-heading">
115
+ <span class="method-name">validate</span><span
116
+ class="method-args">(phone_number)</span>
117
+
118
+ <span class="method-click-advice">click to toggle source</span>
119
+
120
+ </div>
121
+
122
+
123
+ <div class="method-description">
124
+
125
+ <p>Validates any United States phone number!</p>
126
+
127
+ <p><strong>Arguments:</strong></p>
128
+
129
+ <pre>phone_number: (String)</pre>
130
+
131
+
132
+
133
+
134
+ <div class="method-source-code" id="validate-source">
135
+ <pre><span class="ruby-comment"># File lib/phone_number_validator.rb, line 11</span>
136
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">validate</span>(<span class="ruby-identifier">phone_number</span>)
137
+ <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>)
138
+ <span class="ruby-identifier">validator</span>.<span class="ruby-identifier">validate</span>
139
+ <span class="ruby-keyword">end</span></pre>
140
+ </div>
141
+
142
+ </div>
143
+
144
+
145
+
146
+
147
+ </div>
148
+
149
+
150
+ </section>
151
+
152
+ </section>
153
+ </main>
154
+
155
+
156
+ <footer id="validator-badges" role="contentinfo">
157
+ <p><a href="http://validator.w3.org/check/referer">Validate</a>
158
+ <p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.1.
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
+