phone_number_validator 0.7.4 → 0.7.5
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/.gitignore +25 -25
- data/Gemfile +6 -6
- data/LICENSE +21 -21
- data/README.rdoc +59 -59
- data/Rakefile +27 -27
- data/bin/pnv +18 -18
- data/doc/PhoneNumberValidator/Validator.html +230 -230
- data/doc/PhoneNumberValidator.html +160 -160
- data/doc/PhoneNumberValidatorTest.html +235 -235
- data/doc/README_rdoc.html +165 -165
- data/doc/created.rid +6 -6
- data/doc/index.html +159 -159
- data/doc/js/navigation.js.gz +0 -0
- data/doc/js/search_index.js.gz +0 -0
- data/doc/js/searcher.js.gz +0 -0
- data/doc/table_of_contents.html +104 -104
- data/lib/phone_number_validator/validator.rb +34 -34
- data/lib/phone_number_validator.rb +18 -18
- data/phone_number_validator.gemspec +32 -32
- data/test/test_phone_number_validator.rb +31 -31
- metadata +2 -2
data/doc/README_rdoc.html
CHANGED
@@ -1,165 +1,165 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<meta charset="UTF-8">
|
6
|
-
|
7
|
-
<title>README - 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="file">
|
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
|
-
<div class="nav-section">
|
56
|
-
<h3>Table of Contents</h3>
|
57
|
-
|
58
|
-
<ul class="link-list" role="directory">
|
59
|
-
<li><a href="#label-Phone+Number+Validator">Phone Number Validator</a>
|
60
|
-
<li><a href="#label-About">About</a>
|
61
|
-
<li><a href="#label-Regular+Expression">Regular Expression</a>
|
62
|
-
<li><a href="#label-Installing">Installing</a>
|
63
|
-
<li><a href="#label-Install+Required+Gems-2FDependencies">Install Required Gems/Dependencies</a>
|
64
|
-
<li><a href="#label-Updateing+Required+Gems-2FDependencies">Updateing Required Gems/Dependencies</a>
|
65
|
-
<li><a href="#label-Uninstalling">Uninstalling</a>
|
66
|
-
<li><a href="#label-Testing">Testing</a>
|
67
|
-
<li><a href="#label-Usage">Usage</a>
|
68
|
-
<li><a href="#label-In+command+line">In command line</a>
|
69
|
-
<li><a href="#label-Output">Output</a>
|
70
|
-
<li><a href="#label-In+Ruby+code">In Ruby code</a>
|
71
|
-
<li><a href="#label-Output">Output</a>
|
72
|
-
</ul>
|
73
|
-
</div>
|
74
|
-
|
75
|
-
|
76
|
-
<div id="project-metadata">
|
77
|
-
<div id="fileindex-section" class="nav-section">
|
78
|
-
<h3>Pages</h3>
|
79
|
-
|
80
|
-
<ul class="link-list">
|
81
|
-
|
82
|
-
<li><a href="./README_rdoc.html">README</a>
|
83
|
-
|
84
|
-
</ul>
|
85
|
-
</div>
|
86
|
-
|
87
|
-
</div>
|
88
|
-
</nav>
|
89
|
-
|
90
|
-
<main role="main" aria-label="Page README.rdoc">
|
91
|
-
|
92
|
-
<h1 id="label-Phone+Number+Validator">Phone Number Validator<span><a href="#label-Phone+Number+Validator">¶</a> <a href="#top">↑</a></span></h1>
|
93
|
-
|
94
|
-
<h2 id="label-About">About<span><a href="#label-About">¶</a> <a href="#top">↑</a></span></h2>
|
95
|
-
|
96
|
-
<p>This app is a US phone number-validating RubyGem.</p>
|
97
|
-
|
98
|
-
<p>It uses a complex regular expression to validate any United States phone
|
99
|
-
number.</p>
|
100
|
-
|
101
|
-
<h3 id="label-Regular+Expression">Regular Expression<span><a href="#label-Regular+Expression">¶</a> <a href="#top">↑</a></span></h3>
|
102
|
-
|
103
|
-
<p>This gem uses the following regular expression:</p>
|
104
|
-
|
105
|
-
<pre class="ruby"><span class="ruby-comment"># US Phone Numbers</span>
|
106
|
-
<span class="ruby-regexp">/^(?:(?:[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</span>
|
107
|
-
<span class="ruby-comment"># Regex Flags: i (ignore case)</span>
|
108
|
-
</pre>
|
109
|
-
|
110
|
-
<h2 id="label-Installing">Installing<span><a href="#label-Installing">¶</a> <a href="#top">↑</a></span></h2>
|
111
|
-
|
112
|
-
<pre>$ gem install phone_number_validator</pre>
|
113
|
-
|
114
|
-
<h3 id="label-Install+Required+Gems-2FDependencies">Install Required Gems/Dependencies<span><a href="#label-Install+Required+Gems-2FDependencies">¶</a> <a href="#top">↑</a></span></h3>
|
115
|
-
|
116
|
-
<pre>$ bundle install</pre>
|
117
|
-
|
118
|
-
<h3 id="label-Updateing+Required+Gems-2FDependencies">Updateing Required Gems/Dependencies<span><a href="#label-Updateing+Required+Gems-2FDependencies">¶</a> <a href="#top">↑</a></span></h3>
|
119
|
-
|
120
|
-
<pre>$ bundle update</pre>
|
121
|
-
|
122
|
-
<h2 id="label-Uninstalling">Uninstalling<span><a href="#label-Uninstalling">¶</a> <a href="#top">↑</a></span></h2>
|
123
|
-
|
124
|
-
<pre>$ gem uninstall phone_number_validator</pre>
|
125
|
-
|
126
|
-
<h2 id="label-Testing">Testing<span><a href="#label-Testing">¶</a> <a href="#top">↑</a></span></h2>
|
127
|
-
|
128
|
-
<pre>$ rake test</pre>
|
129
|
-
|
130
|
-
<h2 id="label-Usage">Usage<span><a href="#label-Usage">¶</a> <a href="#top">↑</a></span></h2>
|
131
|
-
|
132
|
-
<h3 id="label-In+command+line">In command line<span><a href="#label-In+command+line">¶</a> <a href="#top">↑</a></span></h3>
|
133
|
-
|
134
|
-
<pre>$ pnv "+1 (949) 355-6244 ext. 198842"</pre>
|
135
|
-
|
136
|
-
<h4 id="label-Output">Output<span><a href="#label-Output">¶</a> <a href="#top">↑</a></span></h4>
|
137
|
-
|
138
|
-
<pre>=> true</pre>
|
139
|
-
|
140
|
-
<h3 id="label-In+Ruby+code">In Ruby code<span><a href="#label-In+Ruby+code">¶</a> <a href="#top">↑</a></span></h3>
|
141
|
-
|
142
|
-
<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">'phone_number_validator'</span>
|
143
|
-
|
144
|
-
<span class="ruby-identifier">check_phone_number</span> = <span class="ruby-constant">PhoneNumberValidator</span>.<span class="ruby-identifier">validate_phone_number</span>(<span class="ruby-string">'+1 (949) 355-6244 ext. 198842'</span>)
|
145
|
-
|
146
|
-
<span class="ruby-identifier">print</span> <span class="ruby-identifier">check_phone_number</span>
|
147
|
-
</pre>
|
148
|
-
|
149
|
-
<h4 id="label-Output">Output<span><a href="#label-Output">¶</a> <a href="#top">↑</a></span></h4>
|
150
|
-
|
151
|
-
<pre>=> true</pre>
|
152
|
-
|
153
|
-
<p>Output can be <strong>true</strong> (<em>boolean, valid phone number</em>),
|
154
|
-
<strong>false</strong> (<em>boolean, invalid phone number</em>), or
|
155
|
-
<strong>nil</strong> (<em>symbol, no phone number entered</em>).</p>
|
156
|
-
</main>
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
<footer id="validator-badges" role="contentinfo">
|
161
|
-
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
162
|
-
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.0.
|
163
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
164
|
-
</footer>
|
165
|
-
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>README - 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="file">
|
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
|
+
<div class="nav-section">
|
56
|
+
<h3>Table of Contents</h3>
|
57
|
+
|
58
|
+
<ul class="link-list" role="directory">
|
59
|
+
<li><a href="#label-Phone+Number+Validator">Phone Number Validator</a>
|
60
|
+
<li><a href="#label-About">About</a>
|
61
|
+
<li><a href="#label-Regular+Expression">Regular Expression</a>
|
62
|
+
<li><a href="#label-Installing">Installing</a>
|
63
|
+
<li><a href="#label-Install+Required+Gems-2FDependencies">Install Required Gems/Dependencies</a>
|
64
|
+
<li><a href="#label-Updateing+Required+Gems-2FDependencies">Updateing Required Gems/Dependencies</a>
|
65
|
+
<li><a href="#label-Uninstalling">Uninstalling</a>
|
66
|
+
<li><a href="#label-Testing">Testing</a>
|
67
|
+
<li><a href="#label-Usage">Usage</a>
|
68
|
+
<li><a href="#label-In+command+line">In command line</a>
|
69
|
+
<li><a href="#label-Output">Output</a>
|
70
|
+
<li><a href="#label-In+Ruby+code">In Ruby code</a>
|
71
|
+
<li><a href="#label-Output">Output</a>
|
72
|
+
</ul>
|
73
|
+
</div>
|
74
|
+
|
75
|
+
|
76
|
+
<div id="project-metadata">
|
77
|
+
<div id="fileindex-section" class="nav-section">
|
78
|
+
<h3>Pages</h3>
|
79
|
+
|
80
|
+
<ul class="link-list">
|
81
|
+
|
82
|
+
<li><a href="./README_rdoc.html">README</a>
|
83
|
+
|
84
|
+
</ul>
|
85
|
+
</div>
|
86
|
+
|
87
|
+
</div>
|
88
|
+
</nav>
|
89
|
+
|
90
|
+
<main role="main" aria-label="Page README.rdoc">
|
91
|
+
|
92
|
+
<h1 id="label-Phone+Number+Validator">Phone Number Validator<span><a href="#label-Phone+Number+Validator">¶</a> <a href="#top">↑</a></span></h1>
|
93
|
+
|
94
|
+
<h2 id="label-About">About<span><a href="#label-About">¶</a> <a href="#top">↑</a></span></h2>
|
95
|
+
|
96
|
+
<p>This app is a US phone number-validating RubyGem.</p>
|
97
|
+
|
98
|
+
<p>It uses a complex regular expression to validate any United States phone
|
99
|
+
number.</p>
|
100
|
+
|
101
|
+
<h3 id="label-Regular+Expression">Regular Expression<span><a href="#label-Regular+Expression">¶</a> <a href="#top">↑</a></span></h3>
|
102
|
+
|
103
|
+
<p>This gem uses the following regular expression:</p>
|
104
|
+
|
105
|
+
<pre class="ruby"><span class="ruby-comment"># US Phone Numbers</span>
|
106
|
+
<span class="ruby-regexp">/^(?:(?:[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</span>
|
107
|
+
<span class="ruby-comment"># Regex Flags: i (ignore case)</span>
|
108
|
+
</pre>
|
109
|
+
|
110
|
+
<h2 id="label-Installing">Installing<span><a href="#label-Installing">¶</a> <a href="#top">↑</a></span></h2>
|
111
|
+
|
112
|
+
<pre>$ gem install phone_number_validator</pre>
|
113
|
+
|
114
|
+
<h3 id="label-Install+Required+Gems-2FDependencies">Install Required Gems/Dependencies<span><a href="#label-Install+Required+Gems-2FDependencies">¶</a> <a href="#top">↑</a></span></h3>
|
115
|
+
|
116
|
+
<pre>$ bundle install</pre>
|
117
|
+
|
118
|
+
<h3 id="label-Updateing+Required+Gems-2FDependencies">Updateing Required Gems/Dependencies<span><a href="#label-Updateing+Required+Gems-2FDependencies">¶</a> <a href="#top">↑</a></span></h3>
|
119
|
+
|
120
|
+
<pre>$ bundle update</pre>
|
121
|
+
|
122
|
+
<h2 id="label-Uninstalling">Uninstalling<span><a href="#label-Uninstalling">¶</a> <a href="#top">↑</a></span></h2>
|
123
|
+
|
124
|
+
<pre>$ gem uninstall phone_number_validator</pre>
|
125
|
+
|
126
|
+
<h2 id="label-Testing">Testing<span><a href="#label-Testing">¶</a> <a href="#top">↑</a></span></h2>
|
127
|
+
|
128
|
+
<pre>$ rake test</pre>
|
129
|
+
|
130
|
+
<h2 id="label-Usage">Usage<span><a href="#label-Usage">¶</a> <a href="#top">↑</a></span></h2>
|
131
|
+
|
132
|
+
<h3 id="label-In+command+line">In command line<span><a href="#label-In+command+line">¶</a> <a href="#top">↑</a></span></h3>
|
133
|
+
|
134
|
+
<pre>$ pnv "+1 (949) 355-6244 ext. 198842"</pre>
|
135
|
+
|
136
|
+
<h4 id="label-Output">Output<span><a href="#label-Output">¶</a> <a href="#top">↑</a></span></h4>
|
137
|
+
|
138
|
+
<pre>=> true</pre>
|
139
|
+
|
140
|
+
<h3 id="label-In+Ruby+code">In Ruby code<span><a href="#label-In+Ruby+code">¶</a> <a href="#top">↑</a></span></h3>
|
141
|
+
|
142
|
+
<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">'phone_number_validator'</span>
|
143
|
+
|
144
|
+
<span class="ruby-identifier">check_phone_number</span> = <span class="ruby-constant">PhoneNumberValidator</span>.<span class="ruby-identifier">validate_phone_number</span>(<span class="ruby-string">'+1 (949) 355-6244 ext. 198842'</span>)
|
145
|
+
|
146
|
+
<span class="ruby-identifier">print</span> <span class="ruby-identifier">check_phone_number</span>
|
147
|
+
</pre>
|
148
|
+
|
149
|
+
<h4 id="label-Output">Output<span><a href="#label-Output">¶</a> <a href="#top">↑</a></span></h4>
|
150
|
+
|
151
|
+
<pre>=> true</pre>
|
152
|
+
|
153
|
+
<p>Output can be <strong>true</strong> (<em>boolean, valid phone number</em>),
|
154
|
+
<strong>false</strong> (<em>boolean, invalid phone number</em>), or
|
155
|
+
<strong>nil</strong> (<em>symbol, no phone number entered</em>).</p>
|
156
|
+
</main>
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
<footer id="validator-badges" role="contentinfo">
|
161
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
162
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.0.4.
|
163
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
164
|
+
</footer>
|
165
|
+
|
data/doc/created.rid
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
Sun, 25 Nov 2018
|
2
|
-
README.rdoc
|
3
|
-
lib/phone_number_validator.rb
|
4
|
-
lib/phone_number_validator/validator.rb
|
5
|
-
test/test_phone_number_validator.rb
|
6
|
-
bin/pnv Sun, 25 Nov 2018
|
1
|
+
Sun, 25 Nov 2018 12:15:16 -0800
|
2
|
+
README.rdoc Sun, 25 Nov 2018 11:28:37 -0800
|
3
|
+
lib/phone_number_validator.rb Sun, 25 Nov 2018 11:28:37 -0800
|
4
|
+
lib/phone_number_validator/validator.rb Sun, 25 Nov 2018 11:28:37 -0800
|
5
|
+
test/test_phone_number_validator.rb Sun, 25 Nov 2018 11:28:37 -0800
|
6
|
+
bin/pnv Sun, 25 Nov 2018 12:14:53 -0800
|