apes 1.0.0
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 +7 -0
- data/.gitignore +7 -0
- data/.rubocop.yml +82 -0
- data/.travis-gemfile +15 -0
- data/.travis.yml +15 -0
- data/.yardopts +1 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +22 -0
- data/README.md +177 -0
- data/Rakefile +44 -0
- data/apes.gemspec +34 -0
- data/doc/Apes.html +130 -0
- data/doc/Apes/Concerns.html +127 -0
- data/doc/Apes/Concerns/Errors.html +1089 -0
- data/doc/Apes/Concerns/Pagination.html +636 -0
- data/doc/Apes/Concerns/Request.html +766 -0
- data/doc/Apes/Concerns/Response.html +940 -0
- data/doc/Apes/Controller.html +1100 -0
- data/doc/Apes/Errors.html +125 -0
- data/doc/Apes/Errors/AuthenticationError.html +133 -0
- data/doc/Apes/Errors/BadRequestError.html +157 -0
- data/doc/Apes/Errors/BaseError.html +320 -0
- data/doc/Apes/Errors/InvalidDataError.html +157 -0
- data/doc/Apes/Errors/MissingDataError.html +157 -0
- data/doc/Apes/Model.html +378 -0
- data/doc/Apes/PaginationCursor.html +2138 -0
- data/doc/Apes/RuntimeConfiguration.html +909 -0
- data/doc/Apes/Serializers.html +125 -0
- data/doc/Apes/Serializers/JSON.html +389 -0
- data/doc/Apes/Serializers/JWT.html +452 -0
- data/doc/Apes/Serializers/List.html +347 -0
- data/doc/Apes/UrlsParser.html +1432 -0
- data/doc/Apes/Validators.html +125 -0
- data/doc/Apes/Validators/BaseValidator.html +278 -0
- data/doc/Apes/Validators/BooleanValidator.html +494 -0
- data/doc/Apes/Validators/EmailValidator.html +350 -0
- data/doc/Apes/Validators/PhoneValidator.html +375 -0
- data/doc/Apes/Validators/ReferenceValidator.html +372 -0
- data/doc/Apes/Validators/TimestampValidator.html +640 -0
- data/doc/Apes/Validators/UuidValidator.html +372 -0
- data/doc/Apes/Validators/ZipCodeValidator.html +372 -0
- data/doc/Apes/Version.html +189 -0
- data/doc/ApplicationController.html +547 -0
- data/doc/Concerns.html +128 -0
- data/doc/Concerns/ErrorHandling.html +826 -0
- data/doc/Concerns/PaginationHandling.html +463 -0
- data/doc/Concerns/RequestHandling.html +512 -0
- data/doc/Concerns/ResponseHandling.html +579 -0
- data/doc/Errors.html +126 -0
- data/doc/Errors/AuthenticationError.html +123 -0
- data/doc/Errors/BadRequestError.html +147 -0
- data/doc/Errors/BaseError.html +289 -0
- data/doc/Errors/InvalidDataError.html +147 -0
- data/doc/Errors/MissingDataError.html +147 -0
- data/doc/Model.html +315 -0
- data/doc/PaginationCursor.html +764 -0
- data/doc/Serializers.html +126 -0
- data/doc/Serializers/JSON.html +253 -0
- data/doc/Serializers/JWT.html +253 -0
- data/doc/Serializers/List.html +245 -0
- data/doc/Validators.html +126 -0
- data/doc/Validators/BaseValidator.html +209 -0
- data/doc/Validators/BooleanValidator.html +391 -0
- data/doc/Validators/EmailValidator.html +298 -0
- data/doc/Validators/PhoneValidator.html +313 -0
- data/doc/Validators/ReferenceValidator.html +284 -0
- data/doc/Validators/TimestampValidator.html +476 -0
- data/doc/Validators/UuidValidator.html +310 -0
- data/doc/Validators/ZipCodeValidator.html +310 -0
- data/doc/_index.html +435 -0
- data/doc/class_list.html +58 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +339 -0
- data/doc/file.README.html +252 -0
- data/doc/file_list.html +60 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +252 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +181 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +615 -0
- data/doc/top-level-namespace.html +112 -0
- data/lib/apes.rb +40 -0
- data/lib/apes/concerns/errors.rb +111 -0
- data/lib/apes/concerns/pagination.rb +81 -0
- data/lib/apes/concerns/request.rb +237 -0
- data/lib/apes/concerns/response.rb +74 -0
- data/lib/apes/controller.rb +77 -0
- data/lib/apes/errors.rb +38 -0
- data/lib/apes/model.rb +94 -0
- data/lib/apes/pagination_cursor.rb +152 -0
- data/lib/apes/runtime_configuration.rb +80 -0
- data/lib/apes/serializers.rb +88 -0
- data/lib/apes/urls_parser.rb +233 -0
- data/lib/apes/validators.rb +234 -0
- data/lib/apes/version.rb +24 -0
- data/spec/apes/concerns/errors_spec.rb +141 -0
- data/spec/apes/concerns/pagination_spec.rb +114 -0
- data/spec/apes/concerns/request_spec.rb +244 -0
- data/spec/apes/concerns/response_spec.rb +79 -0
- data/spec/apes/controller_spec.rb +54 -0
- data/spec/apes/errors_spec.rb +14 -0
- data/spec/apes/models_spec.rb +148 -0
- data/spec/apes/pagination_cursor_spec.rb +113 -0
- data/spec/apes/runtime_configuration_spec.rb +100 -0
- data/spec/apes/serializers_spec.rb +70 -0
- data/spec/apes/urls_parser_spec.rb +150 -0
- data/spec/apes/validators_spec.rb +237 -0
- data/spec/spec_helper.rb +30 -0
- data/views/_included.json.jbuilder +9 -0
- data/views/_pagination.json.jbuilder +9 -0
- data/views/collection.json.jbuilder +4 -0
- data/views/errors/400.json.jbuilder +9 -0
- data/views/errors/403.json.jbuilder +7 -0
- data/views/errors/404.json.jbuilder +6 -0
- data/views/errors/422.json.jbuilder +19 -0
- data/views/errors/500.json.jbuilder +12 -0
- data/views/errors/501.json.jbuilder +7 -0
- data/views/layouts/general.json.jbuilder +36 -0
- data/views/object.json.jbuilder +4 -0
- metadata +262 -0
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
4
|
+
<head>
|
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
6
|
+
<title>
|
|
7
|
+
Class: Apes::Validators::UuidValidator
|
|
8
|
+
|
|
9
|
+
— Documentation by YARD 0.8.7.6
|
|
10
|
+
|
|
11
|
+
</title>
|
|
12
|
+
|
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
|
|
14
|
+
|
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />
|
|
16
|
+
|
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
|
19
|
+
relpath = '../../';
|
|
20
|
+
framesUrl = "../../frames.html#!Apes/Validators/UuidValidator.html";
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
|
25
|
+
|
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
</head>
|
|
30
|
+
<body>
|
|
31
|
+
<div id="header">
|
|
32
|
+
<div id="menu">
|
|
33
|
+
|
|
34
|
+
<a href="../../_index.html">Index (U)</a> »
|
|
35
|
+
<span class='title'><span class='object_link'><a href="../../Apes.html" title="Apes (module)">Apes</a></span></span> » <span class='title'><span class='object_link'><a href="../Validators.html" title="Apes::Validators (module)">Validators</a></span></span>
|
|
36
|
+
»
|
|
37
|
+
<span class="title">UuidValidator</span>
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<div id="search">
|
|
44
|
+
|
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
|
46
|
+
href="../../class_list.html">
|
|
47
|
+
Class List
|
|
48
|
+
</a>
|
|
49
|
+
|
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
|
51
|
+
href="../../method_list.html">
|
|
52
|
+
Method List
|
|
53
|
+
</a>
|
|
54
|
+
|
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
|
56
|
+
href="../../file_list.html">
|
|
57
|
+
File List
|
|
58
|
+
</a>
|
|
59
|
+
|
|
60
|
+
</div>
|
|
61
|
+
<div class="clear"></div>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<iframe id="search_frame"></iframe>
|
|
65
|
+
|
|
66
|
+
<div id="content"><h1>Class: Apes::Validators::UuidValidator
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
</h1>
|
|
71
|
+
|
|
72
|
+
<dl class="box">
|
|
73
|
+
|
|
74
|
+
<dt class="r1">Inherits:</dt>
|
|
75
|
+
<dd class="r1">
|
|
76
|
+
<span class="inheritName"><span class='object_link'><a href="BaseValidator.html" title="Apes::Validators::BaseValidator (class)">BaseValidator</a></span></span>
|
|
77
|
+
|
|
78
|
+
<ul class="fullTree">
|
|
79
|
+
<li>Object</li>
|
|
80
|
+
|
|
81
|
+
<li class="next">ActiveModel::EachValidator</li>
|
|
82
|
+
|
|
83
|
+
<li class="next"><span class='object_link'><a href="BaseValidator.html" title="Apes::Validators::BaseValidator (class)">BaseValidator</a></span></li>
|
|
84
|
+
|
|
85
|
+
<li class="next">Apes::Validators::UuidValidator</li>
|
|
86
|
+
|
|
87
|
+
</ul>
|
|
88
|
+
<a href="#" class="inheritanceTree">show all</a>
|
|
89
|
+
|
|
90
|
+
</dd>
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
<dt class="r2 last">Defined in:</dt>
|
|
101
|
+
<dd class="r2 last">lib/apes/validators.rb</dd>
|
|
102
|
+
|
|
103
|
+
</dl>
|
|
104
|
+
<div class="clear"></div>
|
|
105
|
+
|
|
106
|
+
<h2>Overview</h2><div class="docstring">
|
|
107
|
+
<div class="discussion">
|
|
108
|
+
<p>Validates UUIDs (version 4).</p>
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
<div class="tags">
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
</div>
|
|
117
|
+
<h2>Constant Summary</h2>
|
|
118
|
+
|
|
119
|
+
<dl class="constants">
|
|
120
|
+
|
|
121
|
+
<dt id="VALID_REGEX-constant" class="">VALID_REGEX =
|
|
122
|
+
<div class="docstring">
|
|
123
|
+
<div class="discussion">
|
|
124
|
+
<p>The pattern to recognized a valid UUID version 4.</p>
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
<div class="tags">
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
</div>
|
|
133
|
+
</dt>
|
|
134
|
+
<dd><pre class="code"><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\A[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}\z</span><span class='regexp_end'>/i</span></span></pre></dd>
|
|
135
|
+
|
|
136
|
+
</dl>
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
<h2>
|
|
147
|
+
Instance Method Summary
|
|
148
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
|
149
|
+
</h2>
|
|
150
|
+
|
|
151
|
+
<ul class="summary">
|
|
152
|
+
|
|
153
|
+
<li class="public ">
|
|
154
|
+
<span class="summary_signature">
|
|
155
|
+
|
|
156
|
+
<a href="#check_valid%3F-instance_method" title="#check_valid? (instance method)">- (Boolean) <strong>check_valid?</strong>(value) </a>
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
</span>
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
<span class="summary_desc"><div class='inline'><p>Checks if the value is valid for this validator.</p>
|
|
171
|
+
</div></span>
|
|
172
|
+
|
|
173
|
+
</li>
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
<li class="public ">
|
|
177
|
+
<span class="summary_signature">
|
|
178
|
+
|
|
179
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (Apes::Validators::UuidValidator) <strong>initialize</strong>(options) </a>
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
</span>
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
<span class="note title constructor">constructor</span>
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
<span class="summary_desc"><div class='inline'><p>Creates a new validator.</p>
|
|
196
|
+
</div></span>
|
|
197
|
+
|
|
198
|
+
</li>
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
</ul>
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="BaseValidator.html" title="Apes::Validators::BaseValidator (class)">BaseValidator</a></span></h3>
|
|
214
|
+
<p class="inherited"><span class='object_link'><a href="BaseValidator.html#validate_each-instance_method" title="Apes::Validators::BaseValidator#validate_each (method)">#validate_each</a></span></p>
|
|
215
|
+
|
|
216
|
+
<div id="constructor_details" class="method_details_list">
|
|
217
|
+
<h2>Constructor Details</h2>
|
|
218
|
+
|
|
219
|
+
<div class="method_details first">
|
|
220
|
+
<h3 class="signature first" id="initialize-instance_method">
|
|
221
|
+
|
|
222
|
+
- (<tt><span class='object_link'><a href="" title="Apes::Validators::UuidValidator (class)">Apes::Validators::UuidValidator</a></span></tt>) <strong>initialize</strong>(options)
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
</h3><div class="docstring">
|
|
229
|
+
<div class="discussion">
|
|
230
|
+
<p>Creates a new validator.</p>
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
</div>
|
|
234
|
+
</div>
|
|
235
|
+
<div class="tags">
|
|
236
|
+
<p class="tag_title">Parameters:</p>
|
|
237
|
+
<ul class="param">
|
|
238
|
+
|
|
239
|
+
<li>
|
|
240
|
+
|
|
241
|
+
<span class='name'>options</span>
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
—
|
|
249
|
+
<div class='inline'><p>The options for the validations.</p>
|
|
250
|
+
</div>
|
|
251
|
+
|
|
252
|
+
</li>
|
|
253
|
+
|
|
254
|
+
</ul>
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
</div><table class="source_code">
|
|
258
|
+
<tr>
|
|
259
|
+
<td>
|
|
260
|
+
<pre class="lines">
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
72
|
|
264
|
+
73
|
|
265
|
+
74</pre>
|
|
266
|
+
</td>
|
|
267
|
+
<td>
|
|
268
|
+
<pre class="code"><span class="info file"># File 'lib/apes/validators.rb', line 72</span>
|
|
269
|
+
|
|
270
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
|
271
|
+
<span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_reverse_merge'>reverse_merge</span><span class='lparen'>(</span><span class='label'>default_message:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>must be a valid UUID</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
|
|
272
|
+
<span class='kw'>end</span></pre>
|
|
273
|
+
</td>
|
|
274
|
+
</tr>
|
|
275
|
+
</table>
|
|
276
|
+
</div>
|
|
277
|
+
|
|
278
|
+
</div>
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
<div id="instance_method_details" class="method_details_list">
|
|
282
|
+
<h2>Instance Method Details</h2>
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
<div class="method_details first">
|
|
286
|
+
<h3 class="signature first" id="check_valid?-instance_method">
|
|
287
|
+
|
|
288
|
+
- (<tt>Boolean</tt>) <strong>check_valid?</strong>(value)
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
</h3><div class="docstring">
|
|
295
|
+
<div class="discussion">
|
|
296
|
+
<p>Checks if the value is valid for this validator.</p>
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
</div>
|
|
300
|
+
</div>
|
|
301
|
+
<div class="tags">
|
|
302
|
+
<p class="tag_title">Parameters:</p>
|
|
303
|
+
<ul class="param">
|
|
304
|
+
|
|
305
|
+
<li>
|
|
306
|
+
|
|
307
|
+
<span class='name'>value</span>
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
—
|
|
315
|
+
<div class='inline'><p>The value to validate.</p>
|
|
316
|
+
</div>
|
|
317
|
+
|
|
318
|
+
</li>
|
|
319
|
+
|
|
320
|
+
</ul>
|
|
321
|
+
|
|
322
|
+
<p class="tag_title">Returns:</p>
|
|
323
|
+
<ul class="return">
|
|
324
|
+
|
|
325
|
+
<li>
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
—
|
|
333
|
+
<div class='inline'><p><code>true</code> if the value is valid, false otherwise.</p>
|
|
334
|
+
</div>
|
|
335
|
+
|
|
336
|
+
</li>
|
|
337
|
+
|
|
338
|
+
</ul>
|
|
339
|
+
|
|
340
|
+
</div><table class="source_code">
|
|
341
|
+
<tr>
|
|
342
|
+
<td>
|
|
343
|
+
<pre class="lines">
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
80
|
|
347
|
+
81
|
|
348
|
+
82</pre>
|
|
349
|
+
</td>
|
|
350
|
+
<td>
|
|
351
|
+
<pre class="code"><span class="info file"># File 'lib/apes/validators.rb', line 80</span>
|
|
352
|
+
|
|
353
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_check_valid?'>check_valid?</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
|
354
|
+
<span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span> <span class='op'>||</span> <span class='id identifier rubyid_value'>value</span> <span class='op'>=~</span> <span class='const'>VALID_REGEX</span>
|
|
355
|
+
<span class='kw'>end</span></pre>
|
|
356
|
+
</td>
|
|
357
|
+
</tr>
|
|
358
|
+
</table>
|
|
359
|
+
</div>
|
|
360
|
+
|
|
361
|
+
</div>
|
|
362
|
+
|
|
363
|
+
</div>
|
|
364
|
+
|
|
365
|
+
<div id="footer">
|
|
366
|
+
Generated on Sat Jun 4 12:41:53 2016 by
|
|
367
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
368
|
+
0.8.7.6 (ruby-2.3.0).
|
|
369
|
+
</div>
|
|
370
|
+
|
|
371
|
+
</body>
|
|
372
|
+
</html>
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
4
|
+
<head>
|
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
6
|
+
<title>
|
|
7
|
+
Class: Apes::Validators::ZipCodeValidator
|
|
8
|
+
|
|
9
|
+
— Documentation by YARD 0.8.7.6
|
|
10
|
+
|
|
11
|
+
</title>
|
|
12
|
+
|
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
|
|
14
|
+
|
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />
|
|
16
|
+
|
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
|
19
|
+
relpath = '../../';
|
|
20
|
+
framesUrl = "../../frames.html#!Apes/Validators/ZipCodeValidator.html";
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
|
25
|
+
|
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
</head>
|
|
30
|
+
<body>
|
|
31
|
+
<div id="header">
|
|
32
|
+
<div id="menu">
|
|
33
|
+
|
|
34
|
+
<a href="../../_index.html">Index (Z)</a> »
|
|
35
|
+
<span class='title'><span class='object_link'><a href="../../Apes.html" title="Apes (module)">Apes</a></span></span> » <span class='title'><span class='object_link'><a href="../Validators.html" title="Apes::Validators (module)">Validators</a></span></span>
|
|
36
|
+
»
|
|
37
|
+
<span class="title">ZipCodeValidator</span>
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<div id="search">
|
|
44
|
+
|
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
|
46
|
+
href="../../class_list.html">
|
|
47
|
+
Class List
|
|
48
|
+
</a>
|
|
49
|
+
|
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
|
51
|
+
href="../../method_list.html">
|
|
52
|
+
Method List
|
|
53
|
+
</a>
|
|
54
|
+
|
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
|
56
|
+
href="../../file_list.html">
|
|
57
|
+
File List
|
|
58
|
+
</a>
|
|
59
|
+
|
|
60
|
+
</div>
|
|
61
|
+
<div class="clear"></div>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<iframe id="search_frame"></iframe>
|
|
65
|
+
|
|
66
|
+
<div id="content"><h1>Class: Apes::Validators::ZipCodeValidator
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
</h1>
|
|
71
|
+
|
|
72
|
+
<dl class="box">
|
|
73
|
+
|
|
74
|
+
<dt class="r1">Inherits:</dt>
|
|
75
|
+
<dd class="r1">
|
|
76
|
+
<span class="inheritName"><span class='object_link'><a href="BaseValidator.html" title="Apes::Validators::BaseValidator (class)">BaseValidator</a></span></span>
|
|
77
|
+
|
|
78
|
+
<ul class="fullTree">
|
|
79
|
+
<li>Object</li>
|
|
80
|
+
|
|
81
|
+
<li class="next">ActiveModel::EachValidator</li>
|
|
82
|
+
|
|
83
|
+
<li class="next"><span class='object_link'><a href="BaseValidator.html" title="Apes::Validators::BaseValidator (class)">BaseValidator</a></span></li>
|
|
84
|
+
|
|
85
|
+
<li class="next">Apes::Validators::ZipCodeValidator</li>
|
|
86
|
+
|
|
87
|
+
</ul>
|
|
88
|
+
<a href="#" class="inheritanceTree">show all</a>
|
|
89
|
+
|
|
90
|
+
</dd>
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
<dt class="r2 last">Defined in:</dt>
|
|
101
|
+
<dd class="r2 last">lib/apes/validators.rb</dd>
|
|
102
|
+
|
|
103
|
+
</dl>
|
|
104
|
+
<div class="clear"></div>
|
|
105
|
+
|
|
106
|
+
<h2>Overview</h2><div class="docstring">
|
|
107
|
+
<div class="discussion">
|
|
108
|
+
<p>Validates ZIP codes.</p>
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
<div class="tags">
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
</div>
|
|
117
|
+
<h2>Constant Summary</h2>
|
|
118
|
+
|
|
119
|
+
<dl class="constants">
|
|
120
|
+
|
|
121
|
+
<dt id="VALID_REGEX-constant" class="">VALID_REGEX =
|
|
122
|
+
<div class="docstring">
|
|
123
|
+
<div class="discussion">
|
|
124
|
+
<p>The pattern to recognized valid ZIP codes.</p>
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
<div class="tags">
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
</div>
|
|
133
|
+
</dt>
|
|
134
|
+
<dd><pre class="code"><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^(\d{5}(-\d{1,4})?)$</span><span class='regexp_end'>/</span></span></pre></dd>
|
|
135
|
+
|
|
136
|
+
</dl>
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
<h2>
|
|
147
|
+
Instance Method Summary
|
|
148
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
|
149
|
+
</h2>
|
|
150
|
+
|
|
151
|
+
<ul class="summary">
|
|
152
|
+
|
|
153
|
+
<li class="public ">
|
|
154
|
+
<span class="summary_signature">
|
|
155
|
+
|
|
156
|
+
<a href="#check_valid%3F-instance_method" title="#check_valid? (instance method)">- (Boolean) <strong>check_valid?</strong>(value) </a>
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
</span>
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
<span class="summary_desc"><div class='inline'><p>Checks if the value is valid for this validator.</p>
|
|
171
|
+
</div></span>
|
|
172
|
+
|
|
173
|
+
</li>
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
<li class="public ">
|
|
177
|
+
<span class="summary_signature">
|
|
178
|
+
|
|
179
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (Apes::Validators::ZipCodeValidator) <strong>initialize</strong>(options) </a>
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
</span>
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
<span class="note title constructor">constructor</span>
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
<span class="summary_desc"><div class='inline'><p>Creates a new validator.</p>
|
|
196
|
+
</div></span>
|
|
197
|
+
|
|
198
|
+
</li>
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
</ul>
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="BaseValidator.html" title="Apes::Validators::BaseValidator (class)">BaseValidator</a></span></h3>
|
|
214
|
+
<p class="inherited"><span class='object_link'><a href="BaseValidator.html#validate_each-instance_method" title="Apes::Validators::BaseValidator#validate_each (method)">#validate_each</a></span></p>
|
|
215
|
+
|
|
216
|
+
<div id="constructor_details" class="method_details_list">
|
|
217
|
+
<h2>Constructor Details</h2>
|
|
218
|
+
|
|
219
|
+
<div class="method_details first">
|
|
220
|
+
<h3 class="signature first" id="initialize-instance_method">
|
|
221
|
+
|
|
222
|
+
- (<tt><span class='object_link'><a href="" title="Apes::Validators::ZipCodeValidator (class)">Apes::Validators::ZipCodeValidator</a></span></tt>) <strong>initialize</strong>(options)
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
</h3><div class="docstring">
|
|
229
|
+
<div class="discussion">
|
|
230
|
+
<p>Creates a new validator.</p>
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
</div>
|
|
234
|
+
</div>
|
|
235
|
+
<div class="tags">
|
|
236
|
+
<p class="tag_title">Parameters:</p>
|
|
237
|
+
<ul class="param">
|
|
238
|
+
|
|
239
|
+
<li>
|
|
240
|
+
|
|
241
|
+
<span class='name'>options</span>
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
—
|
|
249
|
+
<div class='inline'><p>The options for the validations.</p>
|
|
250
|
+
</div>
|
|
251
|
+
|
|
252
|
+
</li>
|
|
253
|
+
|
|
254
|
+
</ul>
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
</div><table class="source_code">
|
|
258
|
+
<tr>
|
|
259
|
+
<td>
|
|
260
|
+
<pre class="lines">
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
167
|
|
264
|
+
168
|
|
265
|
+
169</pre>
|
|
266
|
+
</td>
|
|
267
|
+
<td>
|
|
268
|
+
<pre class="code"><span class="info file"># File 'lib/apes/validators.rb', line 167</span>
|
|
269
|
+
|
|
270
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
|
271
|
+
<span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_reverse_merge'>reverse_merge</span><span class='lparen'>(</span><span class='label'>default_message:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>must be a valid ZIP code</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
|
|
272
|
+
<span class='kw'>end</span></pre>
|
|
273
|
+
</td>
|
|
274
|
+
</tr>
|
|
275
|
+
</table>
|
|
276
|
+
</div>
|
|
277
|
+
|
|
278
|
+
</div>
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
<div id="instance_method_details" class="method_details_list">
|
|
282
|
+
<h2>Instance Method Details</h2>
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
<div class="method_details first">
|
|
286
|
+
<h3 class="signature first" id="check_valid?-instance_method">
|
|
287
|
+
|
|
288
|
+
- (<tt>Boolean</tt>) <strong>check_valid?</strong>(value)
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
</h3><div class="docstring">
|
|
295
|
+
<div class="discussion">
|
|
296
|
+
<p>Checks if the value is valid for this validator.</p>
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
</div>
|
|
300
|
+
</div>
|
|
301
|
+
<div class="tags">
|
|
302
|
+
<p class="tag_title">Parameters:</p>
|
|
303
|
+
<ul class="param">
|
|
304
|
+
|
|
305
|
+
<li>
|
|
306
|
+
|
|
307
|
+
<span class='name'>value</span>
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
—
|
|
315
|
+
<div class='inline'><p>The value to validate.</p>
|
|
316
|
+
</div>
|
|
317
|
+
|
|
318
|
+
</li>
|
|
319
|
+
|
|
320
|
+
</ul>
|
|
321
|
+
|
|
322
|
+
<p class="tag_title">Returns:</p>
|
|
323
|
+
<ul class="return">
|
|
324
|
+
|
|
325
|
+
<li>
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
—
|
|
333
|
+
<div class='inline'><p><code>true</code> if the value is valid, false otherwise.</p>
|
|
334
|
+
</div>
|
|
335
|
+
|
|
336
|
+
</li>
|
|
337
|
+
|
|
338
|
+
</ul>
|
|
339
|
+
|
|
340
|
+
</div><table class="source_code">
|
|
341
|
+
<tr>
|
|
342
|
+
<td>
|
|
343
|
+
<pre class="lines">
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
175
|
|
347
|
+
176
|
|
348
|
+
177</pre>
|
|
349
|
+
</td>
|
|
350
|
+
<td>
|
|
351
|
+
<pre class="code"><span class="info file"># File 'lib/apes/validators.rb', line 175</span>
|
|
352
|
+
|
|
353
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_check_valid?'>check_valid?</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
|
354
|
+
<span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span> <span class='op'>||</span> <span class='id identifier rubyid_value'>value</span> <span class='op'>=~</span> <span class='const'>VALID_REGEX</span>
|
|
355
|
+
<span class='kw'>end</span></pre>
|
|
356
|
+
</td>
|
|
357
|
+
</tr>
|
|
358
|
+
</table>
|
|
359
|
+
</div>
|
|
360
|
+
|
|
361
|
+
</div>
|
|
362
|
+
|
|
363
|
+
</div>
|
|
364
|
+
|
|
365
|
+
<div id="footer">
|
|
366
|
+
Generated on Sat Jun 4 12:41:54 2016 by
|
|
367
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
368
|
+
0.8.7.6 (ruby-2.3.0).
|
|
369
|
+
</div>
|
|
370
|
+
|
|
371
|
+
</body>
|
|
372
|
+
</html>
|