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,387 @@
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::ValidatesFormat</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">ValidatesFormat</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::ValidatesFormat
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::ValidatesFormat</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_format.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 regular expression.
84
+ </p>
85
+
86
+
87
+ </div>
88
+ </div>
89
+ <div class="tags">
90
+
91
+ <div class="examples">
92
+ <h3>Examples:</h3>
93
+
94
+ <h4>
95
+ Default usage
96
+
97
+ </h4>
98
+ <pre class="example code"> <span class='setup_validations identifier id'>setup_validations</span> <span class='do do kw'>do</span>
99
+ <span class='validates_format_of identifier id'>validates_format_of</span> <span class='symbol val'>:username</span><span class='comma token'>,</span> <span class='symbol val'>:with</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='regexp val'>/[a-z0-9]/i</span>
100
+ <span class='end end kw'>end</span>
101
+ </pre>
102
+
103
+ </div>
104
+
105
+ </div>
106
+ <h2>Constant Summary</h2>
107
+
108
+ <dl class="constants">
109
+
110
+ <dt id="DefaultOptions-constant ">DefaultOptions =
111
+ <span class="summary_desc"></span>
112
+ </dt>
113
+ <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;does not match the given format&quot;</span><span class='rbrace token'>}</span>
114
+ </pre></dd>
115
+
116
+ </dl>
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+ <h3 class="inherited">Constants inherited from <a href="Validation.html" title="WhyValidationsSuckIn96::Validation">WhyValidationsSuckIn96::Validation</a></h3>
133
+ <p class="inherited"><a href="Validation.html#DefaultOptions-constant" title="DefaultOptions">DefaultOptions</a></p>
134
+
135
+
136
+ <h2>Instance Method Summary</h2>
137
+
138
+ <ul class="summary">
139
+
140
+ <li class="public ">
141
+ <span class="summary_signature">
142
+
143
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (ValidatesFormat) <strong>initialize</strong>(validatable, options = {}) </a>
144
+
145
+
146
+
147
+ </span>
148
+
149
+ <span class="note title constructor">constructor</span>
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+ <span class="summary_desc">
158
+ A new instance of ValidatesFormat.
159
+
160
+ </span>
161
+
162
+ </li>
163
+
164
+
165
+ <li class="public ">
166
+ <span class="summary_signature">
167
+
168
+ <a href="#validate-instance_method" title="#validate (instance method)">- (Object) <strong>validate</strong> </a>
169
+
170
+
171
+
172
+ </span>
173
+
174
+
175
+
176
+
177
+
178
+
179
+
180
+ <span class="summary_desc"></span>
181
+
182
+ </li>
183
+
184
+
185
+ </ul>
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+ <h3 class="inherited">Methods included from <a href="AttributeBasedValidation.html" title="WhyValidationsSuckIn96::AttributeBasedValidation">WhyValidationsSuckIn96::AttributeBasedValidation</a></h3>
198
+ <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>
199
+
200
+
201
+
202
+
203
+
204
+
205
+ <h3 class="inherited">Methods inherited from <a href="Validation.html" title="WhyValidationsSuckIn96::Validation">WhyValidationsSuckIn96::Validation</a></h3>
206
+ <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>
207
+ <div id="constructor_details" class="method_details_list">
208
+ <h2>Constructor Details</h2>
209
+
210
+ <div class="method_details first">
211
+ <p class="signature first" id="initialize-instance_method">
212
+
213
+ - (<tt><a href="" title="ValidatesFormat">ValidatesFormat</a></tt>) <strong>initialize</strong>(validatable, options = {})
214
+
215
+
216
+
217
+ </p><div class="docstring">
218
+ <div class="discussion">
219
+ <p>
220
+ A new instance of ValidatesFormat
221
+ </p>
222
+
223
+
224
+ </div>
225
+ </div>
226
+ <div class="tags">
227
+ <h3>Parameters:</h3>
228
+ <ul class="param">
229
+
230
+ <li>
231
+
232
+ <span class='type'>(<tt><a href="../Object.html" title="Object">Object</a></tt>)</span>
233
+
234
+
235
+ <span class='name'>validatable</span>
236
+
237
+
238
+
239
+ &mdash;
240
+
241
+ An object to be validated
242
+
243
+
244
+
245
+ </li>
246
+
247
+ <li>
248
+
249
+ <span class='type'>(<tt>Hash</tt>)</span>
250
+
251
+
252
+ <span class='name'>options</span>
253
+
254
+
255
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
256
+
257
+
258
+ &mdash;
259
+
260
+ The options to set up the validation with
261
+
262
+
263
+
264
+ </li>
265
+
266
+ </ul>
267
+
268
+
269
+
270
+
271
+
272
+
273
+ <h3>Options Hash (<tt>options</tt>):</h3>
274
+ <ul class="option">
275
+
276
+ <li>
277
+ <span class="type">(<tt>Regexp</tt>)</span>
278
+ <span class="name">:with</span>
279
+ <span class="default">
280
+
281
+ <span class="na">N/A</span>
282
+
283
+ </span>
284
+ &mdash;
285
+ A regular expression to check against
286
+
287
+
288
+ </tr>
289
+
290
+ </ul>
291
+
292
+ <h3>Raises:</h3>
293
+ <ul class="raise">
294
+
295
+ <li>
296
+
297
+ <span class='type'>(<tt>ArgumentError</tt>)</span>
298
+
299
+
300
+
301
+
302
+ </li>
303
+
304
+ </ul>
305
+
306
+ </div><table class="source_code">
307
+ <tr>
308
+ <td>
309
+ <pre class="lines">
310
+
311
+
312
+ 21
313
+ 22
314
+ 23
315
+ 24</pre>
316
+ </td>
317
+ <td>
318
+ <pre class="code"><span class="info file"># File 'lib/whyvalidationssuckin96/macros/validates_format.rb', line 21</span>
319
+
320
+ <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>
321
+ <span class='super super kw'>super</span>
322
+ <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;Regular expression to check against must be given as :with&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'>:with</span><span class='rbrack token'>]</span>
323
+ <span class='end end kw'>end</span>
324
+ </pre>
325
+ </td>
326
+ </tr>
327
+ </table>
328
+ </div>
329
+
330
+ </div>
331
+
332
+
333
+ <div id="instance_method_details" class="method_details_list">
334
+ <h2>Instance Method Details</h2>
335
+
336
+
337
+ <div class="method_details first">
338
+ <p class="signature first" id="validate-instance_method">
339
+
340
+ - (<tt><a href="../Object.html" title="Object">Object</a></tt>) <strong>validate</strong>
341
+
342
+
343
+
344
+ </p><table class="source_code">
345
+ <tr>
346
+ <td>
347
+ <pre class="lines">
348
+
349
+
350
+ 26
351
+ 27
352
+ 28
353
+ 29
354
+ 30
355
+ 31
356
+ 32
357
+ 33</pre>
358
+ </td>
359
+ <td>
360
+ <pre class="code"><span class="info file"># File 'lib/whyvalidationssuckin96/macros/validates_format.rb', line 26</span>
361
+
362
+ <span class='def def kw'>def</span> <span class='validate identifier id'>validate</span>
363
+ <span class='super super kw'>super</span>
364
+ <span class='if if kw'>if</span> <span class='attribute_value identifier id'>attribute_value</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span> <span class='match op'>=~</span> <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:with</span><span class='rbrack token'>]</span>
365
+ <span class='pass identifier id'>pass</span>
366
+ <span class='else else kw'>else</span>
367
+ <span class='fail identifier id'>fail</span>
368
+ <span class='end end kw'>end</span>
369
+ <span class='end end kw'>end</span>
370
+ </pre>
371
+ </td>
372
+ </tr>
373
+ </table>
374
+ </div>
375
+
376
+ </div>
377
+
378
+ </div>
379
+
380
+ <div id="footer">
381
+ Generated on Sun Dec 20 19:49:46 2009 by
382
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
383
+ 0.5.2 (ruby-1.8.7).
384
+ </div>
385
+
386
+ </body>
387
+ </html>