phone_number_validator 0.8.8 → 0.8.9
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 +26 -26
- data/Gemfile +6 -6
- data/LICENSE +21 -21
- data/README.rdoc +59 -59
- data/Rakefile +26 -26
- data/bin/pnv +18 -18
- data/doc/PhoneNumberValidator.html +161 -160
- data/doc/PhoneNumberValidator/Validator.html +225 -227
- data/doc/PhoneNumberValidatorTest.html +234 -235
- data/doc/README_rdoc.html +164 -165
- data/doc/created.rid +6 -6
- data/doc/index.html +159 -159
- 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.gz +0 -0
- data/doc/table_of_contents.html +132 -104
- data/lib/phone_number_validator.rb +18 -18
- data/lib/phone_number_validator/validator.rb +33 -33
- data/phone_number_validator.gemspec +34 -34
- data/test/test_phone_number_validator.rb +31 -31
- metadata +3 -4
@@ -1,227 +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
|
-
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
|
-
<
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
<a href="../table_of_contents.html#
|
33
|
-
<a href="../table_of_contents.html#
|
34
|
-
|
35
|
-
</div>
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
aria-
|
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
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
</
|
80
|
-
|
81
|
-
|
82
|
-
</
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
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
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
<span class="ruby-keyword">
|
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
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
<span class="ruby-keyword">
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
<
|
223
|
-
<p
|
224
|
-
|
225
|
-
|
226
|
-
</footer>
|
227
|
-
|
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-value">: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.0.
|
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
|
+
|
@@ -1,235 +1,234 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<meta charset="UTF-8">
|
6
|
-
|
7
|
-
<title>class PhoneNumberValidatorTest - 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
|
-
<
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
<a href="./table_of_contents.html#
|
33
|
-
<a href="./table_of_contents.html#
|
34
|
-
|
35
|
-
</div>
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
aria-
|
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
|
-
|
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
|
-
<strong>false</strong></p>
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
<div class="method-source-code" id="test_invalid_phone_number-source">
|
139
|
-
<pre><span class="ruby-comment"># File test/test_phone_number_validator.rb, line 20</span>
|
140
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">test_invalid_phone_number</span>
|
141
|
-
<span class="ruby-identifier">assert_equal</span> <span class="ruby-keyword">false</span>,
|
142
|
-
<span class="ruby-constant">PhoneNumberValidator</span>.<span class="ruby-identifier">validate</span>(<span class="ruby-string">'94643823637337'</span>)
|
143
|
-
<span class="ruby-keyword">end</span></pre>
|
144
|
-
</div>
|
145
|
-
|
146
|
-
</div>
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
</div>
|
152
|
-
|
153
|
-
|
154
|
-
<div id="method-i-test_no_phone_number" class="method-detail ">
|
155
|
-
|
156
|
-
<div class="method-heading">
|
157
|
-
<span class="method-name">test_no_phone_number</span><span
|
158
|
-
class="method-args">()</span>
|
159
|
-
|
160
|
-
<span class="method-click-advice">click to toggle source</span>
|
161
|
-
|
162
|
-
</div>
|
163
|
-
|
164
|
-
|
165
|
-
<div class="method-description">
|
166
|
-
|
167
|
-
<p>This test inputs no phone number and expects the output to be
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
<span class="ruby-
|
176
|
-
<span class="ruby-identifier">
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
<span class="ruby-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
<
|
231
|
-
<p
|
232
|
-
<p>
|
233
|
-
|
234
|
-
|
235
|
-
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class PhoneNumberValidatorTest - 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">Test::Unit::TestCase
|
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-i-test_invalid_phone_number">#test_invalid_phone_number</a>
|
76
|
+
|
77
|
+
<li ><a href="#method-i-test_no_phone_number">#test_no_phone_number</a>
|
78
|
+
|
79
|
+
<li ><a href="#method-i-test_valid_phone_number">#test_valid_phone_number</a>
|
80
|
+
|
81
|
+
</ul>
|
82
|
+
</div>
|
83
|
+
|
84
|
+
</div>
|
85
|
+
</nav>
|
86
|
+
|
87
|
+
<main role="main" aria-labelledby="class-PhoneNumberValidatorTest">
|
88
|
+
<h1 id="class-PhoneNumberValidatorTest" class="class">
|
89
|
+
class PhoneNumberValidatorTest
|
90
|
+
</h1>
|
91
|
+
|
92
|
+
<section class="description">
|
93
|
+
|
94
|
+
<p>This class represents the testing-unit for this gem app</p>
|
95
|
+
|
96
|
+
<p><strong>Inherits from:</strong></p>
|
97
|
+
|
98
|
+
<pre class="ruby"><span class="ruby-constant">Test</span><span class="ruby-operator">::</span><span class="ruby-constant">Unit</span><span class="ruby-operator">::</span><span class="ruby-constant">TestCase</span>
|
99
|
+
</pre>
|
100
|
+
|
101
|
+
</section>
|
102
|
+
|
103
|
+
|
104
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
115
|
+
<header>
|
116
|
+
<h3>Public Instance Methods</h3>
|
117
|
+
</header>
|
118
|
+
|
119
|
+
|
120
|
+
<div id="method-i-test_invalid_phone_number" class="method-detail ">
|
121
|
+
|
122
|
+
<div class="method-heading">
|
123
|
+
<span class="method-name">test_invalid_phone_number</span><span
|
124
|
+
class="method-args">()</span>
|
125
|
+
|
126
|
+
<span class="method-click-advice">click to toggle source</span>
|
127
|
+
|
128
|
+
</div>
|
129
|
+
|
130
|
+
|
131
|
+
<div class="method-description">
|
132
|
+
|
133
|
+
<p>This test inputs an invalid phone number and expects the output to be <strong>false</strong></p>
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
<div class="method-source-code" id="test_invalid_phone_number-source">
|
139
|
+
<pre><span class="ruby-comment"># File test/test_phone_number_validator.rb, line 20</span>
|
140
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">test_invalid_phone_number</span>
|
141
|
+
<span class="ruby-identifier">assert_equal</span> <span class="ruby-keyword">false</span>,
|
142
|
+
<span class="ruby-constant">PhoneNumberValidator</span>.<span class="ruby-identifier">validate</span>(<span class="ruby-string">'94643823637337'</span>)
|
143
|
+
<span class="ruby-keyword">end</span></pre>
|
144
|
+
</div>
|
145
|
+
|
146
|
+
</div>
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
</div>
|
152
|
+
|
153
|
+
|
154
|
+
<div id="method-i-test_no_phone_number" class="method-detail ">
|
155
|
+
|
156
|
+
<div class="method-heading">
|
157
|
+
<span class="method-name">test_no_phone_number</span><span
|
158
|
+
class="method-args">()</span>
|
159
|
+
|
160
|
+
<span class="method-click-advice">click to toggle source</span>
|
161
|
+
|
162
|
+
</div>
|
163
|
+
|
164
|
+
|
165
|
+
<div class="method-description">
|
166
|
+
|
167
|
+
<p>This test inputs no phone number and expects the output to be <strong>nil</strong></p>
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
<div class="method-source-code" id="test_no_phone_number-source">
|
173
|
+
<pre><span class="ruby-comment"># File test/test_phone_number_validator.rb, line 27</span>
|
174
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">test_no_phone_number</span>
|
175
|
+
<span class="ruby-identifier">assert_equal</span> <span class="ruby-value">:nil</span>,
|
176
|
+
<span class="ruby-constant">PhoneNumberValidator</span>.<span class="ruby-identifier">validate</span>(<span class="ruby-string">''</span>)
|
177
|
+
<span class="ruby-keyword">end</span></pre>
|
178
|
+
</div>
|
179
|
+
|
180
|
+
</div>
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
</div>
|
186
|
+
|
187
|
+
|
188
|
+
<div id="method-i-test_valid_phone_number" class="method-detail ">
|
189
|
+
|
190
|
+
<div class="method-heading">
|
191
|
+
<span class="method-name">test_valid_phone_number</span><span
|
192
|
+
class="method-args">()</span>
|
193
|
+
|
194
|
+
<span class="method-click-advice">click to toggle source</span>
|
195
|
+
|
196
|
+
</div>
|
197
|
+
|
198
|
+
|
199
|
+
<div class="method-description">
|
200
|
+
|
201
|
+
<p>This test inputs a valid phone number and expects the output to be <strong>true</strong></p>
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
<div class="method-source-code" id="test_valid_phone_number-source">
|
207
|
+
<pre><span class="ruby-comment"># File test/test_phone_number_validator.rb, line 13</span>
|
208
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">test_valid_phone_number</span>
|
209
|
+
<span class="ruby-identifier">assert_equal</span> <span class="ruby-keyword">true</span>,
|
210
|
+
<span class="ruby-constant">PhoneNumberValidator</span>.<span class="ruby-identifier">validate</span>(<span class="ruby-string">'+1 (987) 654-3210 ext. 198842'</span>)
|
211
|
+
<span class="ruby-keyword">end</span></pre>
|
212
|
+
</div>
|
213
|
+
|
214
|
+
</div>
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
</div>
|
220
|
+
|
221
|
+
|
222
|
+
</section>
|
223
|
+
|
224
|
+
</section>
|
225
|
+
|
226
|
+
</main>
|
227
|
+
|
228
|
+
|
229
|
+
<footer id="validator-badges" role="contentinfo">
|
230
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
231
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.1.0.
|
232
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
233
|
+
</footer>
|
234
|
+
|