whyvalidationssuckin96 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. data/.document +5 -0
  2. data/.gitignore +22 -0
  3. data/LICENSE +20 -0
  4. data/README.md +121 -0
  5. data/Rakefile +45 -0
  6. data/VERSION +1 -0
  7. data/doc/ActiveRecord/RecordInvalid.html +258 -0
  8. data/doc/ActiveRecord.html +93 -0
  9. data/doc/FalseClass.html +87 -0
  10. data/doc/NilClass.html +87 -0
  11. data/doc/Numeric.html +87 -0
  12. data/doc/Object.html +79 -0
  13. data/doc/String.html +87 -0
  14. data/doc/TrueClass.html +87 -0
  15. data/doc/WhyValidationsSuckIn96/ActiveRecord/InstanceMethods.html +156 -0
  16. data/doc/WhyValidationsSuckIn96/ActiveRecord.html +192 -0
  17. data/doc/WhyValidationsSuckIn96/AttributeBasedValidation.html +464 -0
  18. data/doc/WhyValidationsSuckIn96/SkippableValidation.html +194 -0
  19. data/doc/WhyValidationsSuckIn96/ValidatesAcceptance.html +254 -0
  20. data/doc/WhyValidationsSuckIn96/ValidatesAssociated.html +250 -0
  21. data/doc/WhyValidationsSuckIn96/ValidatesConfirmation.html +251 -0
  22. data/doc/WhyValidationsSuckIn96/ValidatesExclusion.html +388 -0
  23. data/doc/WhyValidationsSuckIn96/ValidatesFormat.html +387 -0
  24. data/doc/WhyValidationsSuckIn96/ValidatesInclusion.html +388 -0
  25. data/doc/WhyValidationsSuckIn96/ValidatesLength.html +469 -0
  26. data/doc/WhyValidationsSuckIn96/ValidatesNumericality.html +267 -0
  27. data/doc/WhyValidationsSuckIn96/ValidatesPresence.html +244 -0
  28. data/doc/WhyValidationsSuckIn96/ValidatesUniqueness.html +289 -0
  29. data/doc/WhyValidationsSuckIn96/Validation.html +934 -0
  30. data/doc/WhyValidationsSuckIn96/ValidationBuilder.html +391 -0
  31. data/doc/WhyValidationsSuckIn96/ValidationSupport/ClassMethods.html +249 -0
  32. data/doc/WhyValidationsSuckIn96/ValidationSupport/InstanceMethods.html +484 -0
  33. data/doc/WhyValidationsSuckIn96/ValidationSupport.html +168 -0
  34. data/doc/WhyValidationsSuckIn96.html +97 -0
  35. data/doc/_index.html +346 -0
  36. data/doc/class_list.html +293 -0
  37. data/doc/css/common.css +1 -0
  38. data/doc/css/full_list.css +23 -0
  39. data/doc/css/style.css +263 -0
  40. data/doc/file.README.html +173 -0
  41. data/doc/file_list.html +29 -0
  42. data/doc/index.html +173 -0
  43. data/doc/js/app.js +91 -0
  44. data/doc/js/full_list.js +39 -0
  45. data/doc/js/jquery.js +19 -0
  46. data/doc/method_list.html +462 -0
  47. data/doc/top-level-namespace.html +81 -0
  48. data/lib/whyvalidationssuckin96/attribute_based_validation.rb +46 -0
  49. data/lib/whyvalidationssuckin96/constants.rb +3 -0
  50. data/lib/whyvalidationssuckin96/ext/blank.rb +47 -0
  51. data/lib/whyvalidationssuckin96/macros/validates_acceptance.rb +36 -0
  52. data/lib/whyvalidationssuckin96/macros/validates_associated.rb +33 -0
  53. data/lib/whyvalidationssuckin96/macros/validates_confirmation.rb +40 -0
  54. data/lib/whyvalidationssuckin96/macros/validates_exclusion.rb +38 -0
  55. data/lib/whyvalidationssuckin96/macros/validates_format.rb +38 -0
  56. data/lib/whyvalidationssuckin96/macros/validates_inclusion.rb +38 -0
  57. data/lib/whyvalidationssuckin96/macros/validates_length.rb +98 -0
  58. data/lib/whyvalidationssuckin96/macros/validates_numericality.rb +56 -0
  59. data/lib/whyvalidationssuckin96/macros/validates_presence.rb +30 -0
  60. data/lib/whyvalidationssuckin96/macros.rb +9 -0
  61. data/lib/whyvalidationssuckin96/rails/active_record.rb +94 -0
  62. data/lib/whyvalidationssuckin96/rails/macros/validates_uniqueness.rb +87 -0
  63. data/lib/whyvalidationssuckin96/rails/macros.rb +1 -0
  64. data/lib/whyvalidationssuckin96/skippable_validation.rb +59 -0
  65. data/lib/whyvalidationssuckin96/validation.rb +88 -0
  66. data/lib/whyvalidationssuckin96/validation_builder.rb +56 -0
  67. data/lib/whyvalidationssuckin96/validation_support.rb +74 -0
  68. data/lib/whyvalidationssuckin96.rb +4 -0
  69. data/test/attribute_based_validation_test.rb +58 -0
  70. data/test/macros/validates_acceptance_test.rb +64 -0
  71. data/test/macros/validates_associated_test.rb +60 -0
  72. data/test/macros/validates_confirmation_test.rb +63 -0
  73. data/test/macros/validates_exclusion_test.rb +37 -0
  74. data/test/macros/validates_format_test.rb +43 -0
  75. data/test/macros/validates_inclusion_test.rb +37 -0
  76. data/test/macros/validates_length_test.rb +179 -0
  77. data/test/macros/validates_numericality_test.rb +129 -0
  78. data/test/macros/validates_presence_test.rb +31 -0
  79. data/test/rails/active_record_test.rb +187 -0
  80. data/test/rails/active_record_test_helper.rb +90 -0
  81. data/test/rails/macros/validates_uniqueness_test.rb +153 -0
  82. data/test/skippable_validation_test.rb +102 -0
  83. data/test/teststrap.rb +4 -0
  84. data/test/validation_builder_test.rb +62 -0
  85. data/test/validation_support_test.rb +209 -0
  86. data/test/validation_test.rb +101 -0
  87. data/whyvalidationssuckin96.gemspec +153 -0
  88. metadata +189 -0
@@ -0,0 +1,192 @@
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::ActiveRecord</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 (A)</a> &raquo;
23
+ <a href="../WhyValidationsSuckIn96.html" title="WhyValidationsSuckIn96">WhyValidationsSuckIn96</a>
24
+ &raquo;
25
+ <span class="title">ActiveRecord</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::ActiveRecord
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/rails/active_record.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
+ ActiveRecord
63
+ </p>
64
+
65
+
66
+ </div>
67
+ </div>
68
+ <div class="tags">
69
+
70
+ </div><h2>Defined Under Namespace</h2>
71
+ <p class="children">
72
+
73
+
74
+ <strong class="modules">Modules:</strong> <a href="ActiveRecord/InstanceMethods.html" title="InstanceMethods">InstanceMethods</a>
75
+
76
+
77
+
78
+
79
+ </p>
80
+
81
+ <h2>Constant Summary</h2>
82
+
83
+ <dl class="constants">
84
+
85
+ <dt id="RemovableInstanceMethods-constant ">RemovableInstanceMethods =
86
+ <span class="summary_desc"></span>
87
+ </dt>
88
+ <dd><pre class="code"><span class='dstring node'>%w[invalid? validate_on_create validate_on_update validate errors]</span>
89
+ </pre></dd>
90
+
91
+ <dt id="RemovableClassMethods-constant ">RemovableClassMethods =
92
+ <span class="summary_desc"></span>
93
+ </dt>
94
+ <dd><pre class="code"><span class='dstring node'>%w[validate validate_on_create validate_on_update validates_format_of validates_each
95
+ validates_inclusion_of validates_size_of validates_confirmation_of validates_exclusion_of
96
+ validates_uniqueness_of validates_associated validates_acceptance_of
97
+ validates_numericality_of validates_presence_of validates_length_of]</span>
98
+ </pre></dd>
99
+
100
+ </dl>
101
+
102
+
103
+
104
+
105
+ <h2>Class Method Summary</h2>
106
+
107
+ <ul class="summary">
108
+
109
+ <li class="public ">
110
+ <span class="summary_signature">
111
+
112
+ <a href="#included-class_method" title="included (class method)">+ (Object) <strong>included</strong>(klass_or_mod) </a>
113
+
114
+
115
+
116
+ </span>
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+ <span class="summary_desc"></span>
125
+
126
+ </li>
127
+
128
+
129
+ </ul>
130
+
131
+
132
+ <div id="class_method_details" class="method_details_list">
133
+ <h2>Class Method Details</h2>
134
+
135
+
136
+ <div class="method_details first">
137
+ <p class="signature first" id="included-class_method">
138
+
139
+ + (<tt><a href="../Object.html" title="Object">Object</a></tt>) <strong>included</strong>(klass_or_mod)
140
+
141
+
142
+
143
+ </p><div class="docstring">
144
+ <div class="discussion">
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
+ 16
158
+ 17
159
+ 18
160
+ 19
161
+ 20
162
+ 21
163
+ 22</pre>
164
+ </td>
165
+ <td>
166
+ <pre class="code"><span class="info file"># File 'lib/whyvalidationssuckin96/rails/active_record.rb', line 16</span>
167
+
168
+ <span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='included identifier id'>included</span><span class='lparen token'>(</span><span class='klass_or_mod identifier id'>klass_or_mod</span><span class='rparen token'>)</span>
169
+ <span class='remove_active_record_validation_related_methods_from identifier id'>remove_active_record_validation_related_methods_from</span><span class='lparen token'>(</span><span class='klass_or_mod identifier id'>klass_or_mod</span><span class='rparen token'>)</span>
170
+ <span class='klass_or_mod identifier id'>klass_or_mod</span><span class='dot token'>.</span><span class='instance_eval identifier id'>instance_eval</span> <span class='do do kw'>do</span>
171
+ <span class='include identifier id'>include</span> <span class='WhyValidationsSuckIn96 constant id'>WhyValidationsSuckIn96</span><span class='colon2 op'>::</span><span class='ValidationSupport constant id'>ValidationSupport</span>
172
+ <span class='include identifier id'>include</span> <span class='WhyValidationsSuckIn96 constant id'>WhyValidationsSuckIn96</span><span class='colon2 op'>::</span><span class='ActiveRecord constant id'>ActiveRecord</span><span class='colon2 op'>::</span><span class='InstanceMethods constant id'>InstanceMethods</span>
173
+ <span class='end end kw'>end</span>
174
+ <span class='end end kw'>end</span>
175
+ </pre>
176
+ </td>
177
+ </tr>
178
+ </table>
179
+ </div>
180
+
181
+ </div>
182
+
183
+ </div>
184
+
185
+ <div id="footer">
186
+ Generated on Sun Dec 20 19:49:46 2009 by
187
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
188
+ 0.5.2 (ruby-1.8.7).
189
+ </div>
190
+
191
+ </body>
192
+ </html>
@@ -0,0 +1,464 @@
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::AttributeBasedValidation</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 (A)</a> &raquo;
23
+ <a href="../WhyValidationsSuckIn96.html" title="WhyValidationsSuckIn96">WhyValidationsSuckIn96</a>
24
+ &raquo;
25
+ <span class="title">AttributeBasedValidation</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::AttributeBasedValidation
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/attribute_based_validation.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
+ A mixin to help handle the most common case of validating a single
63
+ attribute on an object. This module has a dependency on SkippableValidation
64
+ that will most likely be removed in future releases, but is something to be
65
+ aware of currently.
66
+ </p>
67
+
68
+
69
+ </div>
70
+ </div>
71
+ <div class="tags">
72
+
73
+ </div>
74
+
75
+
76
+ <h2>Instance Method Summary</h2>
77
+
78
+ <ul class="summary">
79
+
80
+ <li class="public ">
81
+ <span class="summary_signature">
82
+
83
+ <a href="#attribute-instance_method" title="#attribute (instance method)">- (Object) <strong>attribute</strong> </a>
84
+
85
+
86
+
87
+ </span>
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+ <span class="summary_desc">
96
+ The attribute to validate against.
97
+
98
+ </span>
99
+
100
+ </li>
101
+
102
+
103
+ <li class="public ">
104
+ <span class="summary_signature">
105
+
106
+ <a href="#attribute_value-instance_method" title="#attribute_value (instance method)">- (Object) <strong>attribute_value</strong> </a>
107
+
108
+
109
+
110
+ </span>
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+ <span class="summary_desc">
119
+ The value of the attribute to validate against.
120
+
121
+ </span>
122
+
123
+ </li>
124
+
125
+
126
+ <li class="public ">
127
+ <span class="summary_signature">
128
+
129
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (AttributeBasedValidation) <strong>initialize</strong>(validatable, options = {}) </a>
130
+
131
+
132
+
133
+ </span>
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+ <span class="summary_desc">
142
+ An initializer for a validation that checks to see if the required options
143
+ have been passed for attribute based validation to work as expected.
144
+
145
+ </span>
146
+
147
+ </li>
148
+
149
+
150
+ <li class="public ">
151
+ <span class="summary_signature">
152
+
153
+ <a href="#validate-instance_method" title="#validate (instance method)">- (Object) <strong>validate</strong> </a>
154
+
155
+
156
+
157
+ </span>
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+ <span class="summary_desc">
166
+ A default validate implementation that skips on #nil?/#blank? attribute
167
+ values if :allow_nil or :allow_blank have been set.
168
+
169
+ </span>
170
+
171
+ </li>
172
+
173
+
174
+ </ul>
175
+
176
+
177
+ <div id="instance_method_details" class="method_details_list">
178
+ <h2>Instance Method Details</h2>
179
+
180
+
181
+ <div class="method_details first">
182
+ <p class="signature first" id="attribute-instance_method">
183
+
184
+ - (<tt><a href="../Object.html" title="Object">Object</a></tt>) <strong>attribute</strong>
185
+
186
+
187
+
188
+ </p><div class="docstring">
189
+ <div class="discussion">
190
+ <p>
191
+ The attribute to validate against
192
+ </p>
193
+
194
+
195
+ </div>
196
+ </div>
197
+ <div class="tags">
198
+
199
+ </div><table class="source_code">
200
+ <tr>
201
+ <td>
202
+ <pre class="lines">
203
+
204
+
205
+ 20
206
+ 21
207
+ 22</pre>
208
+ </td>
209
+ <td>
210
+ <pre class="code"><span class="info file"># File 'lib/whyvalidationssuckin96/attribute_based_validation.rb', line 20</span>
211
+
212
+ <span class='def def kw'>def</span> <span class='attribute identifier id'>attribute</span>
213
+ <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:attribute</span><span class='rbrack token'>]</span>
214
+ <span class='end end kw'>end</span>
215
+ </pre>
216
+ </td>
217
+ </tr>
218
+ </table>
219
+ </div>
220
+
221
+ <div class="method_details ">
222
+ <p class="signature " id="attribute_value-instance_method">
223
+
224
+ - (<tt><a href="../Object.html" title="Object">Object</a></tt>) <strong>attribute_value</strong>
225
+
226
+
227
+
228
+ </p><div class="docstring">
229
+ <div class="discussion">
230
+ <p>
231
+ The value of the attribute to validate against
232
+ </p>
233
+
234
+
235
+ </div>
236
+ </div>
237
+ <div class="tags">
238
+
239
+ </div><table class="source_code">
240
+ <tr>
241
+ <td>
242
+ <pre class="lines">
243
+
244
+
245
+ 25
246
+ 26
247
+ 27</pre>
248
+ </td>
249
+ <td>
250
+ <pre class="code"><span class="info file"># File 'lib/whyvalidationssuckin96/attribute_based_validation.rb', line 25</span>
251
+
252
+ <span class='def def kw'>def</span> <span class='attribute_value identifier id'>attribute_value</span>
253
+ <span class='validatable identifier id'>validatable</span><span class='dot token'>.</span><span class='send identifier id'>send</span><span class='lparen token'>(</span><span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:attribute</span><span class='rbrack token'>]</span><span class='rparen token'>)</span>
254
+ <span class='end end kw'>end</span>
255
+ </pre>
256
+ </td>
257
+ </tr>
258
+ </table>
259
+ </div>
260
+
261
+ <div class="method_details ">
262
+ <p class="signature " id="initialize-instance_method">
263
+
264
+ - (<tt><a href="" title="AttributeBasedValidation">AttributeBasedValidation</a></tt>) <strong>initialize</strong>(validatable, options = {})
265
+
266
+
267
+
268
+ </p><div class="docstring">
269
+ <div class="discussion">
270
+ <p>
271
+ An initializer for a validation that checks to see if the required options
272
+ have been passed for attribute based validation to work as expected.
273
+ </p>
274
+
275
+
276
+ </div>
277
+ </div>
278
+ <div class="tags">
279
+ <h3>Parameters:</h3>
280
+ <ul class="param">
281
+
282
+ <li>
283
+
284
+ <span class='type'>(<tt><a href="../Object.html" title="Object">Object</a></tt>)</span>
285
+
286
+
287
+ <span class='name'>validatable</span>
288
+
289
+
290
+
291
+ &mdash;
292
+
293
+ An object to be validated
294
+
295
+
296
+
297
+ </li>
298
+
299
+ <li>
300
+
301
+ <span class='type'>(<tt>Hash</tt>)</span>
302
+
303
+
304
+ <span class='name'>options</span>
305
+
306
+
307
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
308
+
309
+
310
+ &mdash;
311
+
312
+ The options to set up the validation with
313
+
314
+
315
+
316
+ </li>
317
+
318
+ </ul>
319
+
320
+
321
+
322
+
323
+
324
+
325
+ <h3>Options Hash (<tt>options</tt>):</h3>
326
+ <ul class="option">
327
+
328
+ <li>
329
+ <span class="type">(<tt>Symbol</tt>)</span>
330
+ <span class="name">:attribute</span>
331
+ <span class="default">
332
+
333
+ <span class="na">N/A</span>
334
+
335
+ </span>
336
+ &mdash;
337
+ The attribute on the validatable object to validate against
338
+
339
+
340
+ </tr>
341
+
342
+ <li>
343
+ <span class="type">(<tt>true</tt>, <tt>false</tt>)</span>
344
+ <span class="name">:allow_nil</span>
345
+ <span class="default">
346
+
347
+ <span class="na">N/A</span>
348
+
349
+ </span>
350
+ &mdash;
351
+ If true, skips validation of the value of the attribute is #nil?
352
+
353
+
354
+ </tr>
355
+
356
+ <li>
357
+ <span class="type">(<tt>true</tt>, <tt>false</tt>)</span>
358
+ <span class="name">:allow_blank</span>
359
+ <span class="default">
360
+
361
+ <span class="na">N/A</span>
362
+
363
+ </span>
364
+ &mdash;
365
+ If true, skips validation of the value of the attribute is #blank?
366
+
367
+
368
+ </tr>
369
+
370
+ </ul>
371
+
372
+ <h3>Raises:</h3>
373
+ <ul class="raise">
374
+
375
+ <li>
376
+
377
+ <span class='type'>(<tt>ArgumentError</tt>)</span>
378
+
379
+
380
+
381
+
382
+ </li>
383
+
384
+ </ul>
385
+
386
+ </div><table class="source_code">
387
+ <tr>
388
+ <td>
389
+ <pre class="lines">
390
+
391
+
392
+ 14
393
+ 15
394
+ 16
395
+ 17</pre>
396
+ </td>
397
+ <td>
398
+ <pre class="code"><span class="info file"># File 'lib/whyvalidationssuckin96/attribute_based_validation.rb', line 14</span>
399
+
400
+ <span class='def def kw'>def</span> <span class='initialize identifier id'>initialize</span><span class='lparen token'>(</span><span class='validatable identifier id'>validatable</span><span class='comma token'>,</span> <span class='options identifier id'>options</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='rparen token'>)</span>
401
+ <span class='raise identifier id'>raise</span><span class='lparen token'>(</span><span class='ArgumentError constant id'>ArgumentError</span><span class='comma token'>,</span> <span class='string val'>&quot;The attribute to validate must be specified as :attribute&quot;</span><span class='rparen token'>)</span> <span class='unless unless_mod kw'>unless</span> <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:attribute</span><span class='rbrack token'>]</span>
402
+ <span class='super super kw'>super</span>
403
+ <span class='end end kw'>end</span>
404
+ </pre>
405
+ </td>
406
+ </tr>
407
+ </table>
408
+ </div>
409
+
410
+ <div class="method_details ">
411
+ <p class="signature " id="validate-instance_method">
412
+
413
+ - (<tt><a href="../Object.html" title="Object">Object</a></tt>) <strong>validate</strong>
414
+
415
+
416
+
417
+ </p><div class="docstring">
418
+ <div class="discussion">
419
+ <p>
420
+ A default validate implementation that skips on #nil?/#blank? attribute
421
+ values if :allow_nil or :allow_blank have been set.
422
+ </p>
423
+
424
+
425
+ </div>
426
+ </div>
427
+ <div class="tags">
428
+
429
+ </div><table class="source_code">
430
+ <tr>
431
+ <td>
432
+ <pre class="lines">
433
+
434
+
435
+ 31
436
+ 32
437
+ 33
438
+ 34</pre>
439
+ </td>
440
+ <td>
441
+ <pre class="code"><span class="info file"># File 'lib/whyvalidationssuckin96/attribute_based_validation.rb', line 31</span>
442
+
443
+ <span class='def def kw'>def</span> <span class='validate identifier id'>validate</span>
444
+ <span class='skip identifier id'>skip</span> <span class='if if_mod kw'>if</span> <span class='skip_on_blank? fid id'>skip_on_blank?</span> <span class='orop op'>||</span> <span class='skip_on_nil? fid id'>skip_on_nil?</span>
445
+ <span class='super super kw'>super</span>
446
+ <span class='end end kw'>end</span>
447
+ </pre>
448
+ </td>
449
+ </tr>
450
+ </table>
451
+ </div>
452
+
453
+ </div>
454
+
455
+ </div>
456
+
457
+ <div id="footer">
458
+ Generated on Sun Dec 20 19:49:47 2009 by
459
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
460
+ 0.5.2 (ruby-1.8.7).
461
+ </div>
462
+
463
+ </body>
464
+ </html>