phone_number_validator 0.9.8 → 0.9.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/bin/pnv +49 -5
- data/doc/Object.html +200 -0
- data/doc/PhoneNumberValidator/Validator.html +47 -3
- data/doc/PhoneNumberValidator.html +1 -1
- data/doc/created.rid +3 -3
- data/doc/index.html +2 -0
- data/doc/js/search_index.js +1 -1
- data/doc/js/search_index.js.gz +0 -0
- data/doc/table_of_contents.html +10 -0
- data/lib/phone_number_validator/validator.rb +38 -1
- data/phone_number_validator.gemspec +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e3f51e04fbb2e150fa5dc34143aca33efaf5c5c2701ec059ead5d0cb13c919b
|
4
|
+
data.tar.gz: 18c36b42ecd86ffd0873d32693c6d942253c7d3ce67cef946116e87ccfbca493
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17c79127d63cc408f5515e6e2d3b7df651ecb859a0bcbc78821c5fce45fb76bf2c9511156ca95f5c458da802d77bb16f76ed311f163277433f817999df5c65fc
|
7
|
+
data.tar.gz: e622b14281b790b6249fa424d3c2b789387b34e63ea24fc3c35fe5e9cbe3fc97d70c7756ef3c6301838234b70e4dcb2ab707826f82a8997dc7dea8e6463edf7f
|
data/bin/pnv
CHANGED
@@ -10,9 +10,53 @@
|
|
10
10
|
|
11
11
|
require 'phone_number_validator'
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
##
|
14
|
+
# <b>For command line usage:</b>
|
15
|
+
#
|
16
|
+
# Checks to see if the phone number the user entered is valid
|
17
|
+
# by testing regex the pattern with the phone number
|
18
|
+
#
|
19
|
+
# <b>Return Type:</b> boolean or string
|
20
|
+
#
|
21
|
+
# === Examples
|
22
|
+
#
|
23
|
+
# ==== Ex. 1
|
24
|
+
#
|
25
|
+
# $ pnv "+1 (987) 654-3210 ext. 198842"
|
26
|
+
#
|
27
|
+
# ===== Output
|
28
|
+
#
|
29
|
+
# => true
|
30
|
+
#
|
31
|
+
# ==== Ex. 2
|
32
|
+
#
|
33
|
+
# pnv "+1 (987 778873-321a0 ext.ff99"
|
34
|
+
#
|
35
|
+
# ===== Output
|
36
|
+
#
|
37
|
+
# => false
|
38
|
+
#
|
39
|
+
# ==== Ex. 3
|
40
|
+
#
|
41
|
+
# pnv ""
|
42
|
+
#
|
43
|
+
# ===== Output
|
44
|
+
# => "No phone number entered."
|
45
|
+
#
|
46
|
+
# ==== Ex. 4
|
47
|
+
#
|
48
|
+
# pnv
|
49
|
+
#
|
50
|
+
# ===== Output
|
51
|
+
# => "No phone number entered."
|
52
|
+
def pnv
|
53
|
+
if (ARGV[0] == nil || ARGV[0] == '')
|
54
|
+
print "No phone number entered.\r\n"
|
55
|
+
else
|
56
|
+
# execute validator
|
57
|
+
puts PhoneNumberValidator.validate(ARGV[0])
|
58
|
+
end
|
18
59
|
end
|
60
|
+
|
61
|
+
# call pnv function
|
62
|
+
pnv()
|
data/doc/Object.html
ADDED
@@ -0,0 +1,200 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class Object - 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">BasicObject
|
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-pnv">#pnv</a>
|
76
|
+
|
77
|
+
</ul>
|
78
|
+
</div>
|
79
|
+
|
80
|
+
</div>
|
81
|
+
</nav>
|
82
|
+
|
83
|
+
<main role="main" aria-labelledby="class-Object">
|
84
|
+
<h1 id="class-Object" class="class">
|
85
|
+
class Object
|
86
|
+
</h1>
|
87
|
+
|
88
|
+
<section class="description">
|
89
|
+
|
90
|
+
</section>
|
91
|
+
|
92
|
+
|
93
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
104
|
+
<header>
|
105
|
+
<h3>Public Instance Methods</h3>
|
106
|
+
</header>
|
107
|
+
|
108
|
+
|
109
|
+
<div id="method-i-pnv" class="method-detail ">
|
110
|
+
|
111
|
+
<div class="method-heading">
|
112
|
+
<span class="method-name">pnv</span><span
|
113
|
+
class="method-args">()</span>
|
114
|
+
|
115
|
+
<span class="method-click-advice">click to toggle source</span>
|
116
|
+
|
117
|
+
</div>
|
118
|
+
|
119
|
+
|
120
|
+
<div class="method-description">
|
121
|
+
|
122
|
+
<p><strong>For command line usage:</strong></p>
|
123
|
+
|
124
|
+
<p>Checks to see if the phone number the user entered is valid by testing regex the pattern with the phone number</p>
|
125
|
+
|
126
|
+
<p><strong>Return Type:</strong> boolean or string</p>
|
127
|
+
|
128
|
+
<h3 id="method-i-pnv-label-Examples">Examples<span><a href="#method-i-pnv-label-Examples">¶</a> <a href="#top">↑</a></span></h3>
|
129
|
+
|
130
|
+
<h4 id="method-i-pnv-label-Ex.+1">Ex. 1<span><a href="#method-i-pnv-label-Ex.+1">¶</a> <a href="#top">↑</a></span></h4>
|
131
|
+
|
132
|
+
<pre>$ pnv "+1 (987) 654-3210 ext. 198842"</pre>
|
133
|
+
|
134
|
+
<h5 id="method-i-pnv-label-Output">Output<span><a href="#method-i-pnv-label-Output">¶</a> <a href="#top">↑</a></span></h5>
|
135
|
+
|
136
|
+
<pre>=> true</pre>
|
137
|
+
|
138
|
+
<h4 id="method-i-pnv-label-Ex.+2">Ex. 2<span><a href="#method-i-pnv-label-Ex.+2">¶</a> <a href="#top">↑</a></span></h4>
|
139
|
+
|
140
|
+
<pre class="ruby"><span class="ruby-identifier">pnv</span> <span class="ruby-string">"+1 (987 778873-321a0 ext.ff99"</span>
|
141
|
+
</pre>
|
142
|
+
|
143
|
+
<h5 id="method-i-pnv-label-Output">Output<span><a href="#method-i-pnv-label-Output">¶</a> <a href="#top">↑</a></span></h5>
|
144
|
+
|
145
|
+
<pre>=> false</pre>
|
146
|
+
|
147
|
+
<h4 id="method-i-pnv-label-Ex.+3">Ex. 3<span><a href="#method-i-pnv-label-Ex.+3">¶</a> <a href="#top">↑</a></span></h4>
|
148
|
+
|
149
|
+
<pre class="ruby"><span class="ruby-identifier">pnv</span> <span class="ruby-string">""</span>
|
150
|
+
</pre>
|
151
|
+
|
152
|
+
<h5 id="method-i-pnv-label-Output">Output<span><a href="#method-i-pnv-label-Output">¶</a> <a href="#top">↑</a></span></h5>
|
153
|
+
|
154
|
+
<pre>=> "No phone number entered."</pre>
|
155
|
+
|
156
|
+
<h4 id="method-i-pnv-label-Ex.+4">Ex. 4<span><a href="#method-i-pnv-label-Ex.+4">¶</a> <a href="#top">↑</a></span></h4>
|
157
|
+
|
158
|
+
<pre class="ruby"><span class="ruby-identifier">pnv</span>
|
159
|
+
</pre>
|
160
|
+
|
161
|
+
<h5 id="method-i-pnv-label-Output">Output<span><a href="#method-i-pnv-label-Output">¶</a> <a href="#top">↑</a></span></h5>
|
162
|
+
|
163
|
+
<pre>=> "No phone number entered."</pre>
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
<div class="method-source-code" id="pnv-source">
|
169
|
+
<pre><span class="ruby-comment"># File bin/pnv, line 52</span>
|
170
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">pnv</span>
|
171
|
+
<span class="ruby-keyword">if</span> (<span class="ruby-constant">ARGV</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword">nil</span> <span class="ruby-operator">||</span> <span class="ruby-constant">ARGV</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-string">''</span>)
|
172
|
+
<span class="ruby-identifier">print</span> <span class="ruby-string">"No phone number entered.\r\n"</span>
|
173
|
+
<span class="ruby-keyword">else</span>
|
174
|
+
<span class="ruby-comment"># execute validator</span>
|
175
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-constant">PhoneNumberValidator</span>.<span class="ruby-identifier">validate</span>(<span class="ruby-constant">ARGV</span>[<span class="ruby-value">0</span>])
|
176
|
+
<span class="ruby-keyword">end</span>
|
177
|
+
<span class="ruby-keyword">end</span></pre>
|
178
|
+
</div>
|
179
|
+
|
180
|
+
</div>
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
</div>
|
186
|
+
|
187
|
+
|
188
|
+
</section>
|
189
|
+
|
190
|
+
</section>
|
191
|
+
|
192
|
+
</main>
|
193
|
+
|
194
|
+
|
195
|
+
<footer id="validator-badges" role="contentinfo">
|
196
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
197
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.1.1.
|
198
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
199
|
+
</footer>
|
200
|
+
|
@@ -60,7 +60,7 @@
|
|
60
60
|
<h3>Parent</h3>
|
61
61
|
|
62
62
|
|
63
|
-
<p class="link">Object
|
63
|
+
<p class="link"><a href="../Object.html">Object</a>
|
64
64
|
|
65
65
|
</div>
|
66
66
|
|
@@ -184,13 +184,57 @@
|
|
184
184
|
|
185
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
186
|
|
187
|
-
<p><strong>Return Type:</strong> boolean or
|
187
|
+
<p><strong>Return Type:</strong> boolean or nil</p>
|
188
|
+
|
189
|
+
<h3 id="method-i-validate-label-Examples">Examples<span><a href="#method-i-validate-label-Examples">¶</a> <a href="#top">↑</a></span></h3>
|
190
|
+
|
191
|
+
<h4 id="method-i-validate-label-Ex.+1">Ex. 1<span><a href="#method-i-validate-label-Ex.+1">¶</a> <a href="#top">↑</a></span></h4>
|
192
|
+
|
193
|
+
<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">'phone_number_validator'</span>
|
194
|
+
|
195
|
+
<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 (987) 654-3210 ext. 198842'</span>)
|
196
|
+
|
197
|
+
<span class="ruby-identifier">print</span> <span class="ruby-identifier">check_phone_number</span>
|
198
|
+
</pre>
|
199
|
+
|
200
|
+
<h5 id="method-i-validate-label-Output">Output<span><a href="#method-i-validate-label-Output">¶</a> <a href="#top">↑</a></span></h5>
|
201
|
+
|
202
|
+
<pre class="ruby"><span class="ruby-keyword">true</span>
|
203
|
+
</pre>
|
204
|
+
|
205
|
+
<h4 id="method-i-validate-label-Ex.+2">Ex. 2<span><a href="#method-i-validate-label-Ex.+2">¶</a> <a href="#top">↑</a></span></h4>
|
206
|
+
|
207
|
+
<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">'phone_number_validator'</span>
|
208
|
+
|
209
|
+
<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 (987 778873-321a0 ext.ff99'</span>)
|
210
|
+
|
211
|
+
<span class="ruby-identifier">print</span> <span class="ruby-identifier">check_phone_number</span>
|
212
|
+
</pre>
|
213
|
+
|
214
|
+
<h5 id="method-i-validate-label-Output">Output<span><a href="#method-i-validate-label-Output">¶</a> <a href="#top">↑</a></span></h5>
|
215
|
+
|
216
|
+
<pre class="ruby"><span class="ruby-keyword">false</span>
|
217
|
+
</pre>
|
218
|
+
|
219
|
+
<h4 id="method-i-validate-label-Ex.+3">Ex. 3<span><a href="#method-i-validate-label-Ex.+3">¶</a> <a href="#top">↑</a></span></h4>
|
220
|
+
|
221
|
+
<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">'phone_number_validator'</span>
|
222
|
+
|
223
|
+
<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">''</span>)
|
224
|
+
|
225
|
+
<span class="ruby-identifier">print</span> <span class="ruby-identifier">check_phone_number</span>
|
226
|
+
</pre>
|
227
|
+
|
228
|
+
<h5 id="method-i-validate-label-Output">Output<span><a href="#method-i-validate-label-Output">¶</a> <a href="#top">↑</a></span></h5>
|
229
|
+
|
230
|
+
<pre class="ruby"><span class="ruby-keyword">nil</span>
|
231
|
+
</pre>
|
188
232
|
|
189
233
|
|
190
234
|
|
191
235
|
|
192
236
|
<div class="method-source-code" id="validate-source">
|
193
|
-
<pre><span class="ruby-comment"># File lib/phone_number_validator/validator.rb, line
|
237
|
+
<pre><span class="ruby-comment"># File lib/phone_number_validator/validator.rb, line 61</span>
|
194
238
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">validate</span>
|
195
239
|
<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
240
|
<span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span>
|
data/doc/created.rid
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
Thu, 08 Aug 2019
|
1
|
+
Thu, 08 Aug 2019 15:06:20 -0700
|
2
2
|
README.rdoc Thu, 08 Aug 2019 14:17:33 -0700
|
3
3
|
lib/phone_number_validator.rb Thu, 08 Aug 2019 14:17:33 -0700
|
4
|
-
lib/phone_number_validator/validator.rb Thu, 08 Aug 2019
|
4
|
+
lib/phone_number_validator/validator.rb Thu, 08 Aug 2019 15:00:41 -0700
|
5
5
|
test/test_phone_number_validator.rb Thu, 08 Aug 2019 14:17:33 -0700
|
6
|
-
bin/pnv Thu, 08 Aug 2019
|
6
|
+
bin/pnv Thu, 08 Aug 2019 15:06:15 -0700
|
data/doc/index.html
CHANGED
data/doc/js/search_index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var search_data = {"index":{"searchIndex":["phonenumbervalidator","validator","phonenumbervalidatortest","new()","test_invalid_phone_number()","test_no_phone_number()","test_valid_phone_number()","validate()","validate()","readme"],"longSearchIndex":["phonenumbervalidator","phonenumbervalidator::validator","phonenumbervalidatortest","phonenumbervalidator::validator::new()","phonenumbervalidatortest#test_invalid_phone_number()","phonenumbervalidatortest#test_no_phone_number()","phonenumbervalidatortest#test_valid_phone_number()","phonenumbervalidator::validate()","phonenumbervalidator::validator#validate()",""],"info":[["PhoneNumberValidator","","PhoneNumberValidator.html","","<p>This class is the master/parent class to all of the validation functionality\n"],["PhoneNumberValidator::Validator","","PhoneNumberValidator/Validator.html","","<p>This class does all of the matching and checking work for the validation of the phone number.\n"],["PhoneNumberValidatorTest","","PhoneNumberValidatorTest.html","","<p>This class represents the testing-unit for this gem app\n<p><strong>Inherits from:</strong>\n\n<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>\n</pre>\n"],["new","PhoneNumberValidator::Validator","PhoneNumberValidator/Validator.html#method-c-new","(phone_number = '+1 (987) 654-3210 ext. 198842')","<p>Initializes the <strong>@phone_number</strong> instance variable\n"],["test_invalid_phone_number","PhoneNumberValidatorTest","PhoneNumberValidatorTest.html#method-i-test_invalid_phone_number","()","<p>This test inputs an invalid phone number and expects the output to be <strong>false</strong>\n"],["test_no_phone_number","PhoneNumberValidatorTest","PhoneNumberValidatorTest.html#method-i-test_no_phone_number","()","<p>This test inputs no phone number and expects the output to be <strong>nil</strong>\n"],["test_valid_phone_number","PhoneNumberValidatorTest","PhoneNumberValidatorTest.html#method-i-test_valid_phone_number","()","<p>This test inputs a valid phone number and expects the output to be <strong>true</strong>\n"],["validate","PhoneNumberValidator","PhoneNumberValidator.html#method-c-validate","(phone_number)","<p>Validates any United States phone number!\n<p><strong>Arguments:</strong>\n\n<pre>phone_number: (String)</pre>\n"],["validate","PhoneNumberValidator::Validator","PhoneNumberValidator/Validator.html#method-i-validate","()","<p>Checks to see if the phone number the user entered is valid by testing regex the pattern with the phone …\n"],["README","","README_rdoc.html","","<p>Phone Number Validator\n<p>About\n<p>This app is a US phone number-validating RubyGem.\n"]]}}
|
1
|
+
var search_data = {"index":{"searchIndex":["object","phonenumbervalidator","validator","phonenumbervalidatortest","new()","pnv()","test_invalid_phone_number()","test_no_phone_number()","test_valid_phone_number()","validate()","validate()","readme"],"longSearchIndex":["object","phonenumbervalidator","phonenumbervalidator::validator","phonenumbervalidatortest","phonenumbervalidator::validator::new()","object#pnv()","phonenumbervalidatortest#test_invalid_phone_number()","phonenumbervalidatortest#test_no_phone_number()","phonenumbervalidatortest#test_valid_phone_number()","phonenumbervalidator::validate()","phonenumbervalidator::validator#validate()",""],"info":[["Object","","Object.html","",""],["PhoneNumberValidator","","PhoneNumberValidator.html","","<p>This class is the master/parent class to all of the validation functionality\n"],["PhoneNumberValidator::Validator","","PhoneNumberValidator/Validator.html","","<p>This class does all of the matching and checking work for the validation of the phone number.\n"],["PhoneNumberValidatorTest","","PhoneNumberValidatorTest.html","","<p>This class represents the testing-unit for this gem app\n<p><strong>Inherits from:</strong>\n\n<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>\n</pre>\n"],["new","PhoneNumberValidator::Validator","PhoneNumberValidator/Validator.html#method-c-new","(phone_number = '+1 (987) 654-3210 ext. 198842')","<p>Initializes the <strong>@phone_number</strong> instance variable\n"],["pnv","Object","Object.html#method-i-pnv","()","<p><strong>For command line usage:</strong>\n<p>Checks to see if the phone number the user entered is valid by testing regex the …\n"],["test_invalid_phone_number","PhoneNumberValidatorTest","PhoneNumberValidatorTest.html#method-i-test_invalid_phone_number","()","<p>This test inputs an invalid phone number and expects the output to be <strong>false</strong>\n"],["test_no_phone_number","PhoneNumberValidatorTest","PhoneNumberValidatorTest.html#method-i-test_no_phone_number","()","<p>This test inputs no phone number and expects the output to be <strong>nil</strong>\n"],["test_valid_phone_number","PhoneNumberValidatorTest","PhoneNumberValidatorTest.html#method-i-test_valid_phone_number","()","<p>This test inputs a valid phone number and expects the output to be <strong>true</strong>\n"],["validate","PhoneNumberValidator","PhoneNumberValidator.html#method-c-validate","(phone_number)","<p>Validates any United States phone number!\n<p><strong>Arguments:</strong>\n\n<pre>phone_number: (String)</pre>\n"],["validate","PhoneNumberValidator::Validator","PhoneNumberValidator/Validator.html#method-i-validate","()","<p>Checks to see if the phone number the user entered is valid by testing regex the pattern with the phone …\n"],["README","","README_rdoc.html","","<p>Phone Number Validator\n<p>About\n<p>This app is a US phone number-validating RubyGem.\n"]]}}
|
data/doc/js/search_index.js.gz
CHANGED
Binary file
|
data/doc/table_of_contents.html
CHANGED
@@ -74,6 +74,11 @@
|
|
74
74
|
<h2 id="classes">Classes and Modules</h2>
|
75
75
|
<ul>
|
76
76
|
|
77
|
+
<li class="class">
|
78
|
+
<a href="Object.html">Object</a>
|
79
|
+
|
80
|
+
</li>
|
81
|
+
|
77
82
|
<li class="class">
|
78
83
|
<a href="PhoneNumberValidator.html">PhoneNumberValidator</a>
|
79
84
|
|
@@ -104,6 +109,11 @@
|
|
104
109
|
—
|
105
110
|
<span class="container">PhoneNumberValidator</span>
|
106
111
|
|
112
|
+
<li class="method">
|
113
|
+
<a href="Object.html#method-i-pnv">#pnv</a>
|
114
|
+
—
|
115
|
+
<span class="container">Object</span>
|
116
|
+
|
107
117
|
<li class="method">
|
108
118
|
<a href="PhoneNumberValidatorTest.html#method-i-test_invalid_phone_number">#test_invalid_phone_number</a>
|
109
119
|
—
|
@@ -20,7 +20,44 @@ class PhoneNumberValidator::Validator
|
|
20
20
|
# Checks to see if the phone number the user entered is valid
|
21
21
|
# by testing regex the pattern with the phone number
|
22
22
|
#
|
23
|
-
# <b>Return Type:</b> boolean or
|
23
|
+
# <b>Return Type:</b> boolean or nil
|
24
|
+
#
|
25
|
+
# === Examples
|
26
|
+
#
|
27
|
+
# ==== Ex. 1
|
28
|
+
#
|
29
|
+
# require 'phone_number_validator'
|
30
|
+
#
|
31
|
+
# check_phone_number = PhoneNumberValidator.validate_phone_number('+1 (987) 654-3210 ext. 198842')
|
32
|
+
#
|
33
|
+
# print check_phone_number
|
34
|
+
#
|
35
|
+
# ===== Output
|
36
|
+
#
|
37
|
+
# true
|
38
|
+
#
|
39
|
+
# ==== Ex. 2
|
40
|
+
#
|
41
|
+
# require 'phone_number_validator'
|
42
|
+
#
|
43
|
+
# check_phone_number = PhoneNumberValidator.validate_phone_number('+1 (987 778873-321a0 ext.ff99')
|
44
|
+
#
|
45
|
+
# print check_phone_number
|
46
|
+
#
|
47
|
+
# ===== Output
|
48
|
+
#
|
49
|
+
# false
|
50
|
+
#
|
51
|
+
# ==== Ex. 3
|
52
|
+
#
|
53
|
+
# require 'phone_number_validator'
|
54
|
+
#
|
55
|
+
# check_phone_number = PhoneNumberValidator.validate_phone_number('')
|
56
|
+
#
|
57
|
+
# print check_phone_number
|
58
|
+
#
|
59
|
+
# ===== Output
|
60
|
+
# nil
|
24
61
|
def validate
|
25
62
|
if (@phone_number.match(PHONE_NUMBER_REGEX))
|
26
63
|
return true
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phone_number_validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bag33188
|
@@ -47,6 +47,7 @@ files:
|
|
47
47
|
- README.rdoc
|
48
48
|
- Rakefile
|
49
49
|
- bin/pnv
|
50
|
+
- doc/Object.html
|
50
51
|
- doc/PhoneNumberValidator.html
|
51
52
|
- doc/PhoneNumberValidator/Validator.html
|
52
53
|
- doc/PhoneNumberValidatorTest.html
|