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.
@@ -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
- </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-new">::new</a>
74
-
75
- <li ><a href="#method-i-validate">#validate</a>
76
-
77
- </ul>
78
- </div>
79
-
80
- </div>
81
- </nav>
82
-
83
- <main role="main" aria-labelledby="class-PhoneNumberValidator::Validator">
84
- <h1 id="class-PhoneNumberValidator::Validator" class="class">
85
- class PhoneNumberValidator::Validator
86
- </h1>
87
-
88
- <section class="description">
89
-
90
- <p>This class does all of the matching and checking work for the validation of
91
- the phone number.</p>
92
-
93
- </section>
94
-
95
-
96
-
97
-
98
- <section id="5Buntitled-5D" class="documentation-section">
99
-
100
-
101
-
102
-
103
-
104
- <section class="constants-list">
105
- <header>
106
- <h3>Constants</h3>
107
- </header>
108
- <dl>
109
-
110
- <dt id="PHONE_NUMBER_REGEX">PHONE_NUMBER_REGEX
111
-
112
- <dd><p>The regex pattern for validating US phone numbers</p>
113
-
114
- <p>Regular Expression tested using <a
115
- href="https://regexr.com/">regexr.com</a></p>
116
-
117
- <p>The regular expression used can be found in <em>README.rdoc</em> on the
118
- documentation&#39;s home page</p>
119
-
120
-
121
- </dl>
122
- </section>
123
-
124
-
125
-
126
-
127
-
128
- <section id="public-class-5Buntitled-5D-method-details" class="method-section">
129
- <header>
130
- <h3>Public Class Methods</h3>
131
- </header>
132
-
133
-
134
- <div id="method-c-new" class="method-detail ">
135
-
136
- <div class="method-heading">
137
- <span class="method-name">new</span><span
138
- class="method-args">(phone_number = '+1 (987) 654-3210 ext. 198842')</span>
139
-
140
- <span class="method-click-advice">click to toggle source</span>
141
-
142
- </div>
143
-
144
-
145
- <div class="method-description">
146
-
147
- <p>Initializes the <strong>@phone_number</strong> instance variable</p>
148
-
149
-
150
-
151
-
152
- <div class="method-source-code" id="new-source">
153
- <pre><span class="ruby-comment"># File lib/phone_number_validator/validator.rb, line 15</span>
154
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">phone_number</span> = <span class="ruby-string">&#39;+1 (987) 654-3210 ext. 198842&#39;</span>)
155
- <span class="ruby-ivar">@phone_number</span> = <span class="ruby-identifier">phone_number</span>
156
- <span class="ruby-keyword">end</span></pre>
157
- </div>
158
-
159
- </div>
160
-
161
-
162
-
163
-
164
- </div>
165
-
166
-
167
- </section>
168
-
169
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
170
- <header>
171
- <h3>Public Instance Methods</h3>
172
- </header>
173
-
174
-
175
- <div id="method-i-validate" class="method-detail ">
176
-
177
- <div class="method-heading">
178
- <span class="method-name">validate</span><span
179
- class="method-args">()</span>
180
-
181
- <span class="method-click-advice">click to toggle source</span>
182
-
183
- </div>
184
-
185
-
186
- <div class="method-description">
187
-
188
- <p>Checks to see if the phone number the user entered is valid by testing
189
- regex the pattern with the phone number</p>
190
-
191
- <p><strong>Return Type:</strong> boolean or symbol</p>
192
-
193
-
194
-
195
-
196
- <div class="method-source-code" id="validate-source">
197
- <pre><span class="ruby-comment"># File lib/phone_number_validator/validator.rb, line 24</span>
198
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">validate</span>
199
- <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>))
200
- <span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span>
201
- <span class="ruby-keyword">elsif</span> (<span class="ruby-ivar">@phone_number</span> <span class="ruby-operator">==</span> <span class="ruby-string">&#39;&#39;</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@phone_number</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">nil</span>)
202
- <span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span>
203
- <span class="ruby-keyword">else</span>
204
- <span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span>
205
- <span class="ruby-keyword">end</span>
206
- <span class="ruby-keyword">end</span></pre>
207
- </div>
208
-
209
- </div>
210
-
211
-
212
-
213
-
214
- </div>
215
-
216
-
217
- </section>
218
-
219
- </section>
220
- </main>
221
-
222
-
223
- <footer id="validator-badges" role="contentinfo">
224
- <p><a href="http://validator.w3.org/check/referer">Validate</a>
225
- <p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.1.
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&#39;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 = &#39;+1 (987) 654-3210 ext. 198842&#39;)</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">&#39;+1 (987) 654-3210 ext. 198842&#39;</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">&#39;&#39;</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
+