phone_number_validator 0.9.4 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +26 -26
- data/Gemfile +6 -6
- data/LICENSE +21 -21
- data/README.rdoc +72 -72
- data/Rakefile +26 -26
- data/bin/pnv +18 -18
- data/doc/PhoneNumberValidator.html +161 -161
- data/doc/PhoneNumberValidator/Validator.html +225 -228
- data/doc/PhoneNumberValidatorTest.html +234 -236
- data/doc/README_rdoc.html +183 -179
- data/doc/created.rid +6 -6
- data/doc/css/fonts.css +6 -6
- data/doc/index.html +176 -172
- data/doc/js/darkfish.js +7 -7
- data/doc/js/navigation.js +3 -4
- data/doc/js/navigation.js.gz +0 -0
- data/doc/js/search_index.js +1 -1
- data/doc/js/search_index.js.gz +0 -0
- data/doc/js/searcher.js +1 -0
- data/doc/js/searcher.js.gz +0 -0
- data/doc/table_of_contents.html +136 -104
- data/lib/phone_number_validator.rb +18 -18
- data/lib/phone_number_validator/validator.rb +33 -33
- data/phone_number_validator.gemspec +34 -36
- data/test/test_phone_number_validator.rb +31 -31
- metadata +3 -44
@@ -1,228 +1,225 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<meta charset="UTF-8">
|
6
|
-
|
7
|
-
<title>class PhoneNumberValidator::Validator - Phone Number Validator</title>
|
8
|
-
|
9
|
-
<script type="text/javascript">
|
10
|
-
var rdoc_rel_prefix = "../";
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
<script src="../js/
|
15
|
-
|
16
|
-
|
17
|
-
<link href="../css/
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
<
|
26
|
-
<
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
<a href="../table_of_contents.html#
|
33
|
-
|
34
|
-
</
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
<div id="search-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
<
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
<li ><a href="#method-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
<
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
<span class="method-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
<span class="method-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
<span class="ruby-keyword">
|
199
|
-
<span class="ruby-keyword">
|
200
|
-
<span class="ruby-keyword">return</span> <span class="ruby-keyword">
|
201
|
-
<span class="ruby-keyword">
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
<
|
224
|
-
|
225
|
-
|
226
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
227
|
-
</footer>
|
228
|
-
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class PhoneNumberValidator::Validator - 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-new">::new</a>
|
76
|
+
|
77
|
+
<li ><a href="#method-i-validate">#validate</a>
|
78
|
+
|
79
|
+
</ul>
|
80
|
+
</div>
|
81
|
+
|
82
|
+
</div>
|
83
|
+
</nav>
|
84
|
+
|
85
|
+
<main role="main" aria-labelledby="class-PhoneNumberValidator::Validator">
|
86
|
+
<h1 id="class-PhoneNumberValidator::Validator" class="class">
|
87
|
+
class PhoneNumberValidator::Validator
|
88
|
+
</h1>
|
89
|
+
|
90
|
+
<section class="description">
|
91
|
+
|
92
|
+
<p>This class does all of the matching and checking work for the validation of the phone number.</p>
|
93
|
+
|
94
|
+
</section>
|
95
|
+
|
96
|
+
|
97
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
<section class="constants-list">
|
104
|
+
<header>
|
105
|
+
<h3>Constants</h3>
|
106
|
+
</header>
|
107
|
+
<dl>
|
108
|
+
|
109
|
+
<dt id="PHONE_NUMBER_REGEX">PHONE_NUMBER_REGEX
|
110
|
+
|
111
|
+
<dd><p>The regex pattern for validating US phone numbers</p>
|
112
|
+
|
113
|
+
<p>Regular Expression tested using <a href="https://regexr.com/">regexr.com</a></p>
|
114
|
+
|
115
|
+
<p>The regular expression used can be found in <em>README.rdoc</em> on the documentation's home page</p>
|
116
|
+
|
117
|
+
|
118
|
+
</dl>
|
119
|
+
</section>
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
126
|
+
<header>
|
127
|
+
<h3>Public Class Methods</h3>
|
128
|
+
</header>
|
129
|
+
|
130
|
+
|
131
|
+
<div id="method-c-new" class="method-detail ">
|
132
|
+
|
133
|
+
<div class="method-heading">
|
134
|
+
<span class="method-name">new</span><span
|
135
|
+
class="method-args">(phone_number = '+1 (987) 654-3210 ext. 198842')</span>
|
136
|
+
|
137
|
+
<span class="method-click-advice">click to toggle source</span>
|
138
|
+
|
139
|
+
</div>
|
140
|
+
|
141
|
+
|
142
|
+
<div class="method-description">
|
143
|
+
|
144
|
+
<p>Initializes the <strong>@phone_number</strong> instance variable</p>
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
<div class="method-source-code" id="new-source">
|
150
|
+
<pre><span class="ruby-comment"># File lib/phone_number_validator/validator.rb, line 15</span>
|
151
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">phone_number</span> = <span class="ruby-string">'+1 (987) 654-3210 ext. 198842'</span>)
|
152
|
+
<span class="ruby-ivar">@phone_number</span> = <span class="ruby-identifier">phone_number</span>
|
153
|
+
<span class="ruby-keyword">end</span></pre>
|
154
|
+
</div>
|
155
|
+
|
156
|
+
</div>
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
</div>
|
162
|
+
|
163
|
+
|
164
|
+
</section>
|
165
|
+
|
166
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
167
|
+
<header>
|
168
|
+
<h3>Public Instance Methods</h3>
|
169
|
+
</header>
|
170
|
+
|
171
|
+
|
172
|
+
<div id="method-i-validate" class="method-detail ">
|
173
|
+
|
174
|
+
<div class="method-heading">
|
175
|
+
<span class="method-name">validate</span><span
|
176
|
+
class="method-args">()</span>
|
177
|
+
|
178
|
+
<span class="method-click-advice">click to toggle source</span>
|
179
|
+
|
180
|
+
</div>
|
181
|
+
|
182
|
+
|
183
|
+
<div class="method-description">
|
184
|
+
|
185
|
+
<p>Checks to see if the phone number the user entered is valid by testing regex the pattern with the phone number</p>
|
186
|
+
|
187
|
+
<p><strong>Return Type:</strong> boolean or symbol</p>
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
<div class="method-source-code" id="validate-source">
|
193
|
+
<pre><span class="ruby-comment"># File lib/phone_number_validator/validator.rb, line 24</span>
|
194
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">validate</span>
|
195
|
+
<span class="ruby-keyword">if</span> (<span class="ruby-ivar">@phone_number</span>.<span class="ruby-identifier">match</span>(<span class="ruby-constant">PHONE_NUMBER_REGEX</span>))
|
196
|
+
<span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span>
|
197
|
+
<span class="ruby-keyword">elsif</span> (<span class="ruby-ivar">@phone_number</span> <span class="ruby-operator">==</span> <span class="ruby-string">''</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@phone_number</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">nil</span>)
|
198
|
+
<span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span>
|
199
|
+
<span class="ruby-keyword">else</span>
|
200
|
+
<span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span>
|
201
|
+
<span class="ruby-keyword">end</span>
|
202
|
+
<span class="ruby-keyword">end</span></pre>
|
203
|
+
</div>
|
204
|
+
|
205
|
+
</div>
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
</div>
|
211
|
+
|
212
|
+
|
213
|
+
</section>
|
214
|
+
|
215
|
+
</section>
|
216
|
+
|
217
|
+
</main>
|
218
|
+
|
219
|
+
|
220
|
+
<footer id="validator-badges" role="contentinfo">
|
221
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
222
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.1.1.
|
223
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
224
|
+
</footer>
|
225
|
+
|