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,388 @@
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::ValidatesExclusion</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> &raquo;
23
+ <a href="../WhyValidationsSuckIn96.html" title="WhyValidationsSuckIn96">WhyValidationsSuckIn96</a>
24
+ &raquo;
25
+ <span class="title">ValidatesExclusion</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::ValidatesExclusion
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="Validation.html" title="WhyValidationsSuckIn96::Validation">WhyValidationsSuckIn96::Validation</a></span>
50
+
51
+ <ul class="fullTree">
52
+ <li><a href="../Object.html" title="Object">Object</a></li>
53
+
54
+ <li class="next"><a href="Validation.html" title="WhyValidationsSuckIn96::Validation">WhyValidationsSuckIn96::Validation</a></li>
55
+
56
+ <li class="next">WhyValidationsSuckIn96::ValidatesExclusion</li>
57
+
58
+ </ul>
59
+ <a href="#" class="inheritanceTree">show all</a>
60
+
61
+ </dd>
62
+
63
+
64
+
65
+
66
+
67
+
68
+ <dt class="r2">Includes:</dt>
69
+ <dd class="r2"><a href="AttributeBasedValidation.html" title="WhyValidationsSuckIn96::AttributeBasedValidation">WhyValidationsSuckIn96::AttributeBasedValidation</a>, <a href="SkippableValidation.html" title="WhyValidationsSuckIn96::SkippableValidation">WhyValidationsSuckIn96::SkippableValidation</a></dd>
70
+
71
+
72
+
73
+
74
+ <dt class="r1 last">Defined in:</dt>
75
+ <dd class="r1 last">lib/whyvalidationssuckin96/macros/validates_exclusion.rb</dd>
76
+
77
+ </dl>
78
+ <div class="clear"></div>
79
+
80
+ <h2>Overview</h2><div class="docstring">
81
+ <div class="discussion">
82
+ <p>
83
+ Checks the validity of an attribute against a collection of excluded
84
+ values.
85
+ </p>
86
+
87
+
88
+ </div>
89
+ </div>
90
+ <div class="tags">
91
+
92
+ <div class="examples">
93
+ <h3>Examples:</h3>
94
+
95
+ <h4>
96
+ Default usage
97
+
98
+ </h4>
99
+ <pre class="example code"> <span class='setup_validations identifier id'>setup_validations</span> <span class='do do kw'>do</span>
100
+ <span class='validates_exclusion_of identifier id'>validates_exclusion_of</span> <span class='symbol val'>:subdomain</span><span class='comma token'>,</span> <span class='symbol val'>:in</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='dstring node'>%w[www ftp]</span>
101
+ <span class='end end kw'>end</span>
102
+ </pre>
103
+
104
+ </div>
105
+
106
+ </div>
107
+ <h2>Constant Summary</h2>
108
+
109
+ <dl class="constants">
110
+
111
+ <dt id="DefaultOptions-constant ">DefaultOptions =
112
+ <span class="summary_desc"></span>
113
+ </dt>
114
+ <dd><pre class="code"><span class='lbrace token'>{</span><span class='symbol val'>:message</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='string val'>&quot;is in the excluded collection&quot;</span><span class='rbrace token'>}</span>
115
+ </pre></dd>
116
+
117
+ </dl>
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+ <h3 class="inherited">Constants inherited from <a href="Validation.html" title="WhyValidationsSuckIn96::Validation">WhyValidationsSuckIn96::Validation</a></h3>
134
+ <p class="inherited"><a href="Validation.html#DefaultOptions-constant" title="DefaultOptions">DefaultOptions</a></p>
135
+
136
+
137
+ <h2>Instance Method Summary</h2>
138
+
139
+ <ul class="summary">
140
+
141
+ <li class="public ">
142
+ <span class="summary_signature">
143
+
144
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (ValidatesExclusion) <strong>initialize</strong>(validatable, options = {}) </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 ValidatesExclusion.
160
+
161
+ </span>
162
+
163
+ </li>
164
+
165
+
166
+ <li class="public ">
167
+ <span class="summary_signature">
168
+
169
+ <a href="#validate-instance_method" title="#validate (instance method)">- (Object) <strong>validate</strong> </a>
170
+
171
+
172
+
173
+ </span>
174
+
175
+
176
+
177
+
178
+
179
+
180
+
181
+ <span class="summary_desc"></span>
182
+
183
+ </li>
184
+
185
+
186
+ </ul>
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+ <h3 class="inherited">Methods included from <a href="AttributeBasedValidation.html" title="WhyValidationsSuckIn96::AttributeBasedValidation">WhyValidationsSuckIn96::AttributeBasedValidation</a></h3>
199
+ <p class="inherited"><a href="AttributeBasedValidation.html#attribute-instance_method" title="#attribute">#attribute</a>, <a href="AttributeBasedValidation.html#attribute_value-instance_method" title="#attribute_value">#attribute_value</a></p>
200
+
201
+
202
+
203
+
204
+
205
+
206
+ <h3 class="inherited">Methods inherited from <a href="Validation.html" title="WhyValidationsSuckIn96::Validation">WhyValidationsSuckIn96::Validation</a></h3>
207
+ <p class="inherited"><a href="Validation.html#failed%3F-instance_method" title="#failed?">#failed?</a>, <a href="Validation.html#has_run%3F-instance_method" title="#has_run?">#has_run?</a>, <a href="Validation.html#message-instance_method" title="#message">#message</a>, <a href="Validation.html#new_subclass-class_method" title="new_subclass">new_subclass</a>, <a href="Validation.html#passed%3F-instance_method" title="#passed?">#passed?</a>, <a href="Validation.html#validates%3F-instance_method" title="#validates?">#validates?</a></p>
208
+ <div id="constructor_details" class="method_details_list">
209
+ <h2>Constructor Details</h2>
210
+
211
+ <div class="method_details first">
212
+ <p class="signature first" id="initialize-instance_method">
213
+
214
+ - (<tt><a href="" title="ValidatesExclusion">ValidatesExclusion</a></tt>) <strong>initialize</strong>(validatable, options = {})
215
+
216
+
217
+
218
+ </p><div class="docstring">
219
+ <div class="discussion">
220
+ <p>
221
+ A new instance of ValidatesExclusion
222
+ </p>
223
+
224
+
225
+ </div>
226
+ </div>
227
+ <div class="tags">
228
+ <h3>Parameters:</h3>
229
+ <ul class="param">
230
+
231
+ <li>
232
+
233
+ <span class='type'>(<tt><a href="../Object.html" title="Object">Object</a></tt>)</span>
234
+
235
+
236
+ <span class='name'>validatable</span>
237
+
238
+
239
+
240
+ &mdash;
241
+
242
+ An object to be validated.
243
+
244
+
245
+
246
+ </li>
247
+
248
+ <li>
249
+
250
+ <span class='type'>(<tt>Hash</tt>)</span>
251
+
252
+
253
+ <span class='name'>options</span>
254
+
255
+
256
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
257
+
258
+
259
+ &mdash;
260
+
261
+ The options to set up the validation with.
262
+
263
+
264
+
265
+ </li>
266
+
267
+ </ul>
268
+
269
+
270
+
271
+
272
+
273
+
274
+ <h3>Options Hash (<tt>options</tt>):</h3>
275
+ <ul class="option">
276
+
277
+ <li>
278
+ <span class="type">(<tt>#include?</tt>)</span>
279
+ <span class="name">:in</span>
280
+ <span class="default">
281
+
282
+ <span class="na">N/A</span>
283
+
284
+ </span>
285
+ &mdash;
286
+ A collection to check against for exclusion.
287
+
288
+
289
+ </tr>
290
+
291
+ </ul>
292
+
293
+ <h3>Raises:</h3>
294
+ <ul class="raise">
295
+
296
+ <li>
297
+
298
+ <span class='type'>(<tt>ArgumentError</tt>)</span>
299
+
300
+
301
+
302
+
303
+ </li>
304
+
305
+ </ul>
306
+
307
+ </div><table class="source_code">
308
+ <tr>
309
+ <td>
310
+ <pre class="lines">
311
+
312
+
313
+ 21
314
+ 22
315
+ 23
316
+ 24</pre>
317
+ </td>
318
+ <td>
319
+ <pre class="code"><span class="info file"># File 'lib/whyvalidationssuckin96/macros/validates_exclusion.rb', line 21</span>
320
+
321
+ <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>
322
+ <span class='super super kw'>super</span>
323
+ <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;Collection to check for exclusion against should be specified with :in&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'>:in</span><span class='rbrack token'>]</span>
324
+ <span class='end end kw'>end</span>
325
+ </pre>
326
+ </td>
327
+ </tr>
328
+ </table>
329
+ </div>
330
+
331
+ </div>
332
+
333
+
334
+ <div id="instance_method_details" class="method_details_list">
335
+ <h2>Instance Method Details</h2>
336
+
337
+
338
+ <div class="method_details first">
339
+ <p class="signature first" id="validate-instance_method">
340
+
341
+ - (<tt><a href="../Object.html" title="Object">Object</a></tt>) <strong>validate</strong>
342
+
343
+
344
+
345
+ </p><table class="source_code">
346
+ <tr>
347
+ <td>
348
+ <pre class="lines">
349
+
350
+
351
+ 26
352
+ 27
353
+ 28
354
+ 29
355
+ 30
356
+ 31
357
+ 32
358
+ 33</pre>
359
+ </td>
360
+ <td>
361
+ <pre class="code"><span class="info file"># File 'lib/whyvalidationssuckin96/macros/validates_exclusion.rb', line 26</span>
362
+
363
+ <span class='def def kw'>def</span> <span class='validate identifier id'>validate</span>
364
+ <span class='super super kw'>super</span>
365
+ <span class='if if kw'>if</span> <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:in</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='include? fid id'>include?</span><span class='lparen token'>(</span><span class='attribute_value identifier id'>attribute_value</span><span class='rparen token'>)</span>
366
+ <span class='fail identifier id'>fail</span>
367
+ <span class='else else kw'>else</span>
368
+ <span class='pass identifier id'>pass</span>
369
+ <span class='end end kw'>end</span>
370
+ <span class='end end kw'>end</span>
371
+ </pre>
372
+ </td>
373
+ </tr>
374
+ </table>
375
+ </div>
376
+
377
+ </div>
378
+
379
+ </div>
380
+
381
+ <div id="footer">
382
+ Generated on Sun Dec 20 19:49:47 2009 by
383
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
384
+ 0.5.2 (ruby-1.8.7).
385
+ </div>
386
+
387
+ </body>
388
+ </html>