whyvalidationssuckin96 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +22 -0
- data/LICENSE +20 -0
- data/README.md +121 -0
- data/Rakefile +45 -0
- data/VERSION +1 -0
- data/doc/ActiveRecord/RecordInvalid.html +258 -0
- data/doc/ActiveRecord.html +93 -0
- data/doc/FalseClass.html +87 -0
- data/doc/NilClass.html +87 -0
- data/doc/Numeric.html +87 -0
- data/doc/Object.html +79 -0
- data/doc/String.html +87 -0
- data/doc/TrueClass.html +87 -0
- data/doc/WhyValidationsSuckIn96/ActiveRecord/InstanceMethods.html +156 -0
- data/doc/WhyValidationsSuckIn96/ActiveRecord.html +192 -0
- data/doc/WhyValidationsSuckIn96/AttributeBasedValidation.html +464 -0
- data/doc/WhyValidationsSuckIn96/SkippableValidation.html +194 -0
- data/doc/WhyValidationsSuckIn96/ValidatesAcceptance.html +254 -0
- data/doc/WhyValidationsSuckIn96/ValidatesAssociated.html +250 -0
- data/doc/WhyValidationsSuckIn96/ValidatesConfirmation.html +251 -0
- data/doc/WhyValidationsSuckIn96/ValidatesExclusion.html +388 -0
- data/doc/WhyValidationsSuckIn96/ValidatesFormat.html +387 -0
- data/doc/WhyValidationsSuckIn96/ValidatesInclusion.html +388 -0
- data/doc/WhyValidationsSuckIn96/ValidatesLength.html +469 -0
- data/doc/WhyValidationsSuckIn96/ValidatesNumericality.html +267 -0
- data/doc/WhyValidationsSuckIn96/ValidatesPresence.html +244 -0
- data/doc/WhyValidationsSuckIn96/ValidatesUniqueness.html +289 -0
- data/doc/WhyValidationsSuckIn96/Validation.html +934 -0
- data/doc/WhyValidationsSuckIn96/ValidationBuilder.html +391 -0
- data/doc/WhyValidationsSuckIn96/ValidationSupport/ClassMethods.html +249 -0
- data/doc/WhyValidationsSuckIn96/ValidationSupport/InstanceMethods.html +484 -0
- data/doc/WhyValidationsSuckIn96/ValidationSupport.html +168 -0
- data/doc/WhyValidationsSuckIn96.html +97 -0
- data/doc/_index.html +346 -0
- data/doc/class_list.html +293 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +23 -0
- data/doc/css/style.css +263 -0
- data/doc/file.README.html +173 -0
- data/doc/file_list.html +29 -0
- data/doc/index.html +173 -0
- data/doc/js/app.js +91 -0
- data/doc/js/full_list.js +39 -0
- data/doc/js/jquery.js +19 -0
- data/doc/method_list.html +462 -0
- data/doc/top-level-namespace.html +81 -0
- data/lib/whyvalidationssuckin96/attribute_based_validation.rb +46 -0
- data/lib/whyvalidationssuckin96/constants.rb +3 -0
- data/lib/whyvalidationssuckin96/ext/blank.rb +47 -0
- data/lib/whyvalidationssuckin96/macros/validates_acceptance.rb +36 -0
- data/lib/whyvalidationssuckin96/macros/validates_associated.rb +33 -0
- data/lib/whyvalidationssuckin96/macros/validates_confirmation.rb +40 -0
- data/lib/whyvalidationssuckin96/macros/validates_exclusion.rb +38 -0
- data/lib/whyvalidationssuckin96/macros/validates_format.rb +38 -0
- data/lib/whyvalidationssuckin96/macros/validates_inclusion.rb +38 -0
- data/lib/whyvalidationssuckin96/macros/validates_length.rb +98 -0
- data/lib/whyvalidationssuckin96/macros/validates_numericality.rb +56 -0
- data/lib/whyvalidationssuckin96/macros/validates_presence.rb +30 -0
- data/lib/whyvalidationssuckin96/macros.rb +9 -0
- data/lib/whyvalidationssuckin96/rails/active_record.rb +94 -0
- data/lib/whyvalidationssuckin96/rails/macros/validates_uniqueness.rb +87 -0
- data/lib/whyvalidationssuckin96/rails/macros.rb +1 -0
- data/lib/whyvalidationssuckin96/skippable_validation.rb +59 -0
- data/lib/whyvalidationssuckin96/validation.rb +88 -0
- data/lib/whyvalidationssuckin96/validation_builder.rb +56 -0
- data/lib/whyvalidationssuckin96/validation_support.rb +74 -0
- data/lib/whyvalidationssuckin96.rb +4 -0
- data/test/attribute_based_validation_test.rb +58 -0
- data/test/macros/validates_acceptance_test.rb +64 -0
- data/test/macros/validates_associated_test.rb +60 -0
- data/test/macros/validates_confirmation_test.rb +63 -0
- data/test/macros/validates_exclusion_test.rb +37 -0
- data/test/macros/validates_format_test.rb +43 -0
- data/test/macros/validates_inclusion_test.rb +37 -0
- data/test/macros/validates_length_test.rb +179 -0
- data/test/macros/validates_numericality_test.rb +129 -0
- data/test/macros/validates_presence_test.rb +31 -0
- data/test/rails/active_record_test.rb +187 -0
- data/test/rails/active_record_test_helper.rb +90 -0
- data/test/rails/macros/validates_uniqueness_test.rb +153 -0
- data/test/skippable_validation_test.rb +102 -0
- data/test/teststrap.rb +4 -0
- data/test/validation_builder_test.rb +62 -0
- data/test/validation_support_test.rb +209 -0
- data/test/validation_test.rb +101 -0
- data/whyvalidationssuckin96.gemspec +153 -0
- metadata +189 -0
@@ -0,0 +1,391 @@
|
|
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 name="Content-Type" content="text/html; charset=UTF-8" />
|
6
|
+
<title>Class: WhyValidationsSuckIn96::ValidationBuilder</title>
|
7
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
8
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
9
|
+
|
10
|
+
<script type="text/javascript" charset="utf-8">
|
11
|
+
relpath = '..';
|
12
|
+
if (relpath != '') relpath += '/';
|
13
|
+
</script>
|
14
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
15
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
16
|
+
|
17
|
+
</head>
|
18
|
+
<body>
|
19
|
+
<div id="header">
|
20
|
+
<div id="menu">
|
21
|
+
|
22
|
+
<a href="../_index.html">Index (V)</a> »
|
23
|
+
<a href="../WhyValidationsSuckIn96.html" title="WhyValidationsSuckIn96">WhyValidationsSuckIn96</a>
|
24
|
+
»
|
25
|
+
<span class="title">ValidationBuilder</span>
|
26
|
+
|
27
|
+
</div>
|
28
|
+
|
29
|
+
<div id="search">
|
30
|
+
<a id="class_list_link" href="#">Namespace List</a>
|
31
|
+
<a id="method_list_link" href="#">Method List</a>
|
32
|
+
<a id ="file_list_link" href="#">File List</a>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div class="clear"></div>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<iframe id="search_frame"></iframe>
|
39
|
+
|
40
|
+
<div id="content"><h1>Class: WhyValidationsSuckIn96::ValidationBuilder
|
41
|
+
|
42
|
+
|
43
|
+
</h1>
|
44
|
+
|
45
|
+
<dl class="box">
|
46
|
+
|
47
|
+
<dt class="r1">Inherits:</dt>
|
48
|
+
<dd class="r1">
|
49
|
+
<span class="inheritName"><a href="../Object.html" title="Object">Object</a></span>
|
50
|
+
|
51
|
+
<ul class="fullTree">
|
52
|
+
<li><a href="../Object.html" title="Object">Object</a></li>
|
53
|
+
|
54
|
+
<li class="next">WhyValidationsSuckIn96::ValidationBuilder</li>
|
55
|
+
|
56
|
+
</ul>
|
57
|
+
<a href="#" class="inheritanceTree">show all</a>
|
58
|
+
|
59
|
+
</dd>
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
<dt class="r2 last">Defined in:</dt>
|
69
|
+
<dd class="r2 last">lib/whyvalidationssuckin96/validation_builder.rb</dd>
|
70
|
+
|
71
|
+
</dl>
|
72
|
+
<div class="clear"></div>
|
73
|
+
|
74
|
+
<h2>Overview</h2><div class="docstring">
|
75
|
+
<div class="discussion">
|
76
|
+
<p>
|
77
|
+
ValidationBuilder
|
78
|
+
</p>
|
79
|
+
|
80
|
+
|
81
|
+
</div>
|
82
|
+
</div>
|
83
|
+
<div class="tags">
|
84
|
+
|
85
|
+
</div>
|
86
|
+
|
87
|
+
|
88
|
+
<h2>Class Method Summary</h2>
|
89
|
+
|
90
|
+
<ul class="summary">
|
91
|
+
|
92
|
+
<li class="public ">
|
93
|
+
<span class="summary_signature">
|
94
|
+
|
95
|
+
<a href="#register_macro-class_method" title="register_macro (class method)">+ (Object) <strong>register_macro</strong>(macro_name, validation_class) </a>
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
</span>
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
<span class="summary_desc">
|
108
|
+
Registers a macro to be used in setup_validations blocks.
|
109
|
+
|
110
|
+
</span>
|
111
|
+
|
112
|
+
</li>
|
113
|
+
|
114
|
+
|
115
|
+
</ul>
|
116
|
+
|
117
|
+
<h2>Instance Method Summary</h2>
|
118
|
+
|
119
|
+
<ul class="summary">
|
120
|
+
|
121
|
+
<li class="public ">
|
122
|
+
<span class="summary_signature">
|
123
|
+
|
124
|
+
<a href="#create_validations%21-instance_method" title="#create_validations! (instance method)">- (Object) <strong>create_validations!</strong> </a>
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
</span>
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
<span class="summary_desc"></span>
|
137
|
+
|
138
|
+
</li>
|
139
|
+
|
140
|
+
|
141
|
+
<li class="public ">
|
142
|
+
<span class="summary_signature">
|
143
|
+
|
144
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (ValidationBuilder) <strong>initialize</strong>(klass_or_mod, definition_block) </a>
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
</span>
|
149
|
+
|
150
|
+
<span class="note title constructor">constructor</span>
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
<span class="summary_desc">
|
159
|
+
A new instance of ValidationBuilder.
|
160
|
+
|
161
|
+
</span>
|
162
|
+
|
163
|
+
</li>
|
164
|
+
|
165
|
+
|
166
|
+
</ul>
|
167
|
+
<div id="constructor_details" class="method_details_list">
|
168
|
+
<h2>Constructor Details</h2>
|
169
|
+
|
170
|
+
<div class="method_details first">
|
171
|
+
<p class="signature first" id="initialize-instance_method">
|
172
|
+
|
173
|
+
- (<tt><a href="" title="ValidationBuilder">ValidationBuilder</a></tt>) <strong>initialize</strong>(klass_or_mod, definition_block)
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
</p><div class="docstring">
|
178
|
+
<div class="discussion">
|
179
|
+
<p>
|
180
|
+
A new instance of ValidationBuilder
|
181
|
+
</p>
|
182
|
+
|
183
|
+
|
184
|
+
</div>
|
185
|
+
</div>
|
186
|
+
<div class="tags">
|
187
|
+
<h3>Parameters:</h3>
|
188
|
+
<ul class="param">
|
189
|
+
|
190
|
+
<li>
|
191
|
+
|
192
|
+
<span class='type'>(<tt>Module</tt>, <tt>Class</tt>)</span>
|
193
|
+
|
194
|
+
|
195
|
+
<span class='name'>klass_or_mod</span>
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
—
|
200
|
+
|
201
|
+
The Class or Module to add validations to
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
</li>
|
206
|
+
|
207
|
+
<li>
|
208
|
+
|
209
|
+
<span class='type'>(<tt>Proc</tt>)</span>
|
210
|
+
|
211
|
+
|
212
|
+
<span class='name'>definition_block</span>
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
—
|
217
|
+
|
218
|
+
The block to evaluate to define validations
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
</li>
|
223
|
+
|
224
|
+
</ul>
|
225
|
+
|
226
|
+
</div><table class="source_code">
|
227
|
+
<tr>
|
228
|
+
<td>
|
229
|
+
<pre class="lines">
|
230
|
+
|
231
|
+
|
232
|
+
8
|
233
|
+
9
|
234
|
+
10
|
235
|
+
11</pre>
|
236
|
+
</td>
|
237
|
+
<td>
|
238
|
+
<pre class="code"><span class="info file"># File 'lib/whyvalidationssuckin96/validation_builder.rb', line 8</span>
|
239
|
+
|
240
|
+
<span class='def def kw'>def</span> <span class='initialize identifier id'>initialize</span><span class='lparen token'>(</span><span class='klass_or_mod identifier id'>klass_or_mod</span><span class='comma token'>,</span> <span class='definition_block identifier id'>definition_block</span><span class='rparen token'>)</span>
|
241
|
+
<span class='@klass_or_mod ivar id'>@klass_or_mod</span> <span class='assign token'>=</span> <span class='klass_or_mod identifier id'>klass_or_mod</span>
|
242
|
+
<span class='@definition_block ivar id'>@definition_block</span> <span class='assign token'>=</span> <span class='definition_block identifier id'>definition_block</span>
|
243
|
+
<span class='end end kw'>end</span>
|
244
|
+
</pre>
|
245
|
+
</td>
|
246
|
+
</tr>
|
247
|
+
</table>
|
248
|
+
</div>
|
249
|
+
|
250
|
+
</div>
|
251
|
+
|
252
|
+
|
253
|
+
<div id="class_method_details" class="method_details_list">
|
254
|
+
<h2>Class Method Details</h2>
|
255
|
+
|
256
|
+
|
257
|
+
<div class="method_details first">
|
258
|
+
<p class="signature first" id="register_macro-class_method">
|
259
|
+
|
260
|
+
+ (<tt><a href="../Object.html" title="Object">Object</a></tt>) <strong>register_macro</strong>(macro_name, validation_class)
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
</p><div class="docstring">
|
265
|
+
<div class="discussion">
|
266
|
+
<p>
|
267
|
+
Registers a macro to be used in setup_validations blocks
|
268
|
+
</p>
|
269
|
+
|
270
|
+
|
271
|
+
</div>
|
272
|
+
</div>
|
273
|
+
<div class="tags">
|
274
|
+
<h3>Parameters:</h3>
|
275
|
+
<ul class="param">
|
276
|
+
|
277
|
+
<li>
|
278
|
+
|
279
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
280
|
+
|
281
|
+
|
282
|
+
<span class='name'>macro_name</span>
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
—
|
287
|
+
|
288
|
+
The name to register this macro with
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
</li>
|
293
|
+
|
294
|
+
<li>
|
295
|
+
|
296
|
+
<span class='type'>(<tt>Class</tt>)</span>
|
297
|
+
|
298
|
+
|
299
|
+
<span class='name'>validation_class</span>
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
—
|
304
|
+
|
305
|
+
The class implementing the validation
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
</li>
|
310
|
+
|
311
|
+
</ul>
|
312
|
+
|
313
|
+
</div><table class="source_code">
|
314
|
+
<tr>
|
315
|
+
<td>
|
316
|
+
<pre class="lines">
|
317
|
+
|
318
|
+
|
319
|
+
20
|
320
|
+
21
|
321
|
+
22
|
322
|
+
23
|
323
|
+
24
|
324
|
+
25
|
325
|
+
26
|
326
|
+
27</pre>
|
327
|
+
</td>
|
328
|
+
<td>
|
329
|
+
<pre class="code"><span class="info file"># File 'lib/whyvalidationssuckin96/validation_builder.rb', line 20</span>
|
330
|
+
|
331
|
+
<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='register_macro identifier id'>register_macro</span><span class='lparen token'>(</span><span class='macro_name identifier id'>macro_name</span><span class='comma token'>,</span> <span class='validation_class identifier id'>validation_class</span><span class='rparen token'>)</span>
|
332
|
+
<span class='define_method identifier id'>define_method</span><span class='lparen token'>(</span><span class='macro_name identifier id'>macro_name</span><span class='rparen token'>)</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='mult op'>*</span><span class='args identifier id'>args</span><span class='bitor op'>|</span>
|
333
|
+
<span class='attrs identifier id'>attrs</span><span class='comma token'>,</span> <span class='options identifier id'>options</span> <span class='assign token'>=</span> <span class='extract_options identifier id'>extract_options</span><span class='lparen token'>(</span><span class='args identifier id'>args</span><span class='rparen token'>)</span>
|
334
|
+
<span class='attrs identifier id'>attrs</span><span class='dot token'>.</span><span class='each identifier id'>each</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='attr identifier id'>attr</span><span class='bitor op'>|</span>
|
335
|
+
<span class='add_validation identifier id'>add_validation</span><span class='lparen token'>(</span><span class='validation_class identifier id'>validation_class</span><span class='comma token'>,</span> <span class='options identifier id'>options</span><span class='dot token'>.</span><span class='merge identifier id'>merge</span><span class='lparen token'>(</span><span class='symbol val'>:attribute</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='attr identifier id'>attr</span><span class='rparen token'>)</span><span class='rparen token'>)</span>
|
336
|
+
<span class='end end kw'>end</span>
|
337
|
+
<span class='end end kw'>end</span>
|
338
|
+
<span class='end end kw'>end</span>
|
339
|
+
</pre>
|
340
|
+
</td>
|
341
|
+
</tr>
|
342
|
+
</table>
|
343
|
+
</div>
|
344
|
+
|
345
|
+
</div>
|
346
|
+
|
347
|
+
<div id="instance_method_details" class="method_details_list">
|
348
|
+
<h2>Instance Method Details</h2>
|
349
|
+
|
350
|
+
|
351
|
+
<div class="method_details first">
|
352
|
+
<p class="signature first" id="create_validations!-instance_method">
|
353
|
+
|
354
|
+
- (<tt><a href="../Object.html" title="Object">Object</a></tt>) <strong>create_validations!</strong>
|
355
|
+
|
356
|
+
|
357
|
+
|
358
|
+
</p><table class="source_code">
|
359
|
+
<tr>
|
360
|
+
<td>
|
361
|
+
<pre class="lines">
|
362
|
+
|
363
|
+
|
364
|
+
13
|
365
|
+
14
|
366
|
+
15</pre>
|
367
|
+
</td>
|
368
|
+
<td>
|
369
|
+
<pre class="code"><span class="info file"># File 'lib/whyvalidationssuckin96/validation_builder.rb', line 13</span>
|
370
|
+
|
371
|
+
<span class='def def kw'>def</span> <span class='create_validations! fid id'>create_validations!</span>
|
372
|
+
<span class='instance_eval identifier id'>instance_eval</span><span class='lparen token'>(</span><span class='bitand op'>&</span><span class='@definition_block ivar id'>@definition_block</span><span class='rparen token'>)</span>
|
373
|
+
<span class='end end kw'>end</span>
|
374
|
+
</pre>
|
375
|
+
</td>
|
376
|
+
</tr>
|
377
|
+
</table>
|
378
|
+
</div>
|
379
|
+
|
380
|
+
</div>
|
381
|
+
|
382
|
+
</div>
|
383
|
+
|
384
|
+
<div id="footer">
|
385
|
+
Generated on Sun Dec 20 19:49:46 2009 by
|
386
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
|
387
|
+
0.5.2 (ruby-1.8.7).
|
388
|
+
</div>
|
389
|
+
|
390
|
+
</body>
|
391
|
+
</html>
|
@@ -0,0 +1,249 @@
|
|
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 name="Content-Type" content="text/html; charset=UTF-8" />
|
6
|
+
<title>Module: WhyValidationsSuckIn96::ValidationSupport::ClassMethods</title>
|
7
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
8
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
9
|
+
|
10
|
+
<script type="text/javascript" charset="utf-8">
|
11
|
+
relpath = '../..';
|
12
|
+
if (relpath != '') relpath += '/';
|
13
|
+
</script>
|
14
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
15
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
16
|
+
|
17
|
+
</head>
|
18
|
+
<body>
|
19
|
+
<div id="header">
|
20
|
+
<div id="menu">
|
21
|
+
|
22
|
+
<a href="../../_index.html">Index (C)</a> »
|
23
|
+
<a href="../../WhyValidationsSuckIn96.html" title="WhyValidationsSuckIn96">WhyValidationsSuckIn96</a> » <a href="../ValidationSupport.html" title="ValidationSupport">ValidationSupport</a>
|
24
|
+
»
|
25
|
+
<span class="title">ClassMethods</span>
|
26
|
+
|
27
|
+
</div>
|
28
|
+
|
29
|
+
<div id="search">
|
30
|
+
<a id="class_list_link" href="#">Namespace List</a>
|
31
|
+
<a id="method_list_link" href="#">Method List</a>
|
32
|
+
<a id ="file_list_link" href="#">File List</a>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div class="clear"></div>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<iframe id="search_frame"></iframe>
|
39
|
+
|
40
|
+
<div id="content"><h1>Module: WhyValidationsSuckIn96::ValidationSupport::ClassMethods
|
41
|
+
|
42
|
+
|
43
|
+
</h1>
|
44
|
+
|
45
|
+
<dl class="box">
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
<dt class="r1 last">Defined in:</dt>
|
54
|
+
<dd class="r1 last">lib/whyvalidationssuckin96/validation_support.rb</dd>
|
55
|
+
|
56
|
+
</dl>
|
57
|
+
<div class="clear"></div>
|
58
|
+
|
59
|
+
<h2>Overview</h2><div class="docstring">
|
60
|
+
<div class="discussion">
|
61
|
+
<p>
|
62
|
+
ClassMethods
|
63
|
+
</p>
|
64
|
+
|
65
|
+
|
66
|
+
</div>
|
67
|
+
</div>
|
68
|
+
<div class="tags">
|
69
|
+
|
70
|
+
</div>
|
71
|
+
|
72
|
+
|
73
|
+
<h2>Instance Method Summary</h2>
|
74
|
+
|
75
|
+
<ul class="summary">
|
76
|
+
|
77
|
+
<li class="public ">
|
78
|
+
<span class="summary_signature">
|
79
|
+
|
80
|
+
<a href="#setup_validations-instance_method" title="#setup_validations (instance method)">- (Object) <strong>setup_validations</strong>(&definition_block) </a>
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
</span>
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
<span class="summary_desc">
|
93
|
+
Sets up validations for the class or module this module has been mixed
|
94
|
+
into.
|
95
|
+
|
96
|
+
</span>
|
97
|
+
|
98
|
+
</li>
|
99
|
+
|
100
|
+
|
101
|
+
<li class="public ">
|
102
|
+
<span class="summary_signature">
|
103
|
+
|
104
|
+
<a href="#validation_collection-instance_method" title="#validation_collection (instance method)">- (Array) <strong>validation_collection</strong> </a>
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
</span>
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
<span class="summary_desc">
|
117
|
+
An array of arrays, the first element of each being the validation subclass
|
118
|
+
that will be instantiated when validation is performed, the last element
|
119
|
+
being the options the validation will be instantiated with.
|
120
|
+
|
121
|
+
</span>
|
122
|
+
|
123
|
+
</li>
|
124
|
+
|
125
|
+
|
126
|
+
</ul>
|
127
|
+
|
128
|
+
|
129
|
+
<div id="instance_method_details" class="method_details_list">
|
130
|
+
<h2>Instance Method Details</h2>
|
131
|
+
|
132
|
+
|
133
|
+
<div class="method_details first">
|
134
|
+
<p class="signature first" id="setup_validations-instance_method">
|
135
|
+
|
136
|
+
- (<tt><a href="../../Object.html" title="Object">Object</a></tt>) <strong>setup_validations</strong>(&definition_block)
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
</p><div class="docstring">
|
141
|
+
<div class="discussion">
|
142
|
+
<p>
|
143
|
+
Sets up validations for the class or module this module has been mixed into
|
144
|
+
</p>
|
145
|
+
|
146
|
+
|
147
|
+
</div>
|
148
|
+
</div>
|
149
|
+
<div class="tags">
|
150
|
+
|
151
|
+
</div><table class="source_code">
|
152
|
+
<tr>
|
153
|
+
<td>
|
154
|
+
<pre class="lines">
|
155
|
+
|
156
|
+
|
157
|
+
66
|
158
|
+
67
|
159
|
+
68
|
160
|
+
69
|
161
|
+
70</pre>
|
162
|
+
</td>
|
163
|
+
<td>
|
164
|
+
<pre class="code"><span class="info file"># File 'lib/whyvalidationssuckin96/validation_support.rb', line 66</span>
|
165
|
+
|
166
|
+
<span class='def def kw'>def</span> <span class='setup_validations identifier id'>setup_validations</span><span class='lparen token'>(</span><span class='bitand op'>&</span><span class='definition_block identifier id'>definition_block</span><span class='rparen token'>)</span>
|
167
|
+
<span class='self self kw'>self</span><span class='dot token'>.</span><span class='validation_collection identifier id'>validation_collection</span> <span class='opasgn op'>||=</span> <span class='ancestors identifier id'>ancestors</span><span class='dot token'>.</span><span class='detect identifier id'>detect</span><span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='anc identifier id'>anc</span><span class='bitor op'>|</span> <span class='notop op'>!</span><span class='anc identifier id'>anc</span><span class='dot token'>.</span><span class='validation_collection identifier id'>validation_collection</span><span class='dot token'>.</span><span class='nil? fid id'>nil?</span><span class='rbrace token'>}</span><span class='dot token'>.</span><span class='validation_collection identifier id'>validation_collection</span><span class='dot token'>.</span><span class='dup identifier id'>dup</span>
|
168
|
+
<span class='builder identifier id'>builder</span> <span class='assign token'>=</span> <span class='ValidationBuilder constant id'>ValidationBuilder</span><span class='dot token'>.</span><span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='self self kw'>self</span><span class='comma token'>,</span> <span class='definition_block identifier id'>definition_block</span><span class='rparen token'>)</span>
|
169
|
+
<span class='builder identifier id'>builder</span><span class='dot token'>.</span><span class='create_validations! fid id'>create_validations!</span>
|
170
|
+
<span class='end end kw'>end</span>
|
171
|
+
</pre>
|
172
|
+
</td>
|
173
|
+
</tr>
|
174
|
+
</table>
|
175
|
+
</div>
|
176
|
+
|
177
|
+
<div class="method_details ">
|
178
|
+
<p class="signature " id="validation_collection-instance_method">
|
179
|
+
|
180
|
+
- (<tt>Array</tt>) <strong>validation_collection</strong>
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
</p><div class="docstring">
|
185
|
+
<div class="discussion">
|
186
|
+
<p>
|
187
|
+
An array of arrays, the first element of each being the validation subclass
|
188
|
+
that will be instantiated when validation is performed, the last element
|
189
|
+
being the options the validation will be instantiated with.
|
190
|
+
</p>
|
191
|
+
|
192
|
+
|
193
|
+
</div>
|
194
|
+
</div>
|
195
|
+
<div class="tags">
|
196
|
+
<h3>Returns:</h3>
|
197
|
+
<ul class="return">
|
198
|
+
|
199
|
+
<li>
|
200
|
+
|
201
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
</li>
|
207
|
+
|
208
|
+
</ul>
|
209
|
+
|
210
|
+
</div><table class="source_code">
|
211
|
+
<tr>
|
212
|
+
<td>
|
213
|
+
<pre class="lines">
|
214
|
+
|
215
|
+
|
216
|
+
58
|
217
|
+
59
|
218
|
+
60
|
219
|
+
61
|
220
|
+
62
|
221
|
+
63</pre>
|
222
|
+
</td>
|
223
|
+
<td>
|
224
|
+
<pre class="code"><span class="info file"># File 'lib/whyvalidationssuckin96/validation_support.rb', line 58</span>
|
225
|
+
|
226
|
+
<span class='def def kw'>def</span> <span class='validation_collection identifier id'>validation_collection</span>
|
227
|
+
<span class='@validation_collection ivar id'>@validation_collection</span> <span class='opasgn op'>||=</span> <span class='begin begin kw'>begin</span>
|
228
|
+
<span class='ancestor_with_validations identifier id'>ancestor_with_validations</span> <span class='assign token'>=</span> <span class='ancestors identifier id'>ancestors</span><span class='lbrack token'>[</span><span class='float val'>1</span><span class='dot2 op'>..</span><span class='integer val'>-1</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='detect identifier id'>detect</span><span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='anc identifier id'>anc</span><span class='bitor op'>|</span> <span class='anc identifier id'>anc</span><span class='dot token'>.</span><span class='respond_to? fid id'>respond_to?</span><span class='lparen token'>(</span><span class='symbol val'>:validation_collection</span><span class='rparen token'>)</span> <span class='rbrace token'>}</span>
|
229
|
+
<span class='ancestor_with_validations identifier id'>ancestor_with_validations</span> <span class='integer val'>? </span><span class='ancestor_with_validations identifier id'>ancestor_with_validations</span><span class='dot token'>.</span><span class='validation_collection identifier id'>validation_collection</span><span class='dot token'>.</span><span class='dup identifier id'>dup</span> <span class='colon op'>:</span> <span class='lbrack token'>[</span><span class='rbrack token'>]</span>
|
230
|
+
<span class='end end kw'>end</span>
|
231
|
+
<span class='end end kw'>end</span>
|
232
|
+
</pre>
|
233
|
+
</td>
|
234
|
+
</tr>
|
235
|
+
</table>
|
236
|
+
</div>
|
237
|
+
|
238
|
+
</div>
|
239
|
+
|
240
|
+
</div>
|
241
|
+
|
242
|
+
<div id="footer">
|
243
|
+
Generated on Sun Dec 20 19:49:46 2009 by
|
244
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
|
245
|
+
0.5.2 (ruby-1.8.7).
|
246
|
+
</div>
|
247
|
+
|
248
|
+
</body>
|
249
|
+
</html>
|