kharon 0.5.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +1 -0
  3. data/.rspec +2 -1
  4. data/Gemfile +1 -10
  5. data/Gemfile.lock +29 -16
  6. data/README.md +135 -26
  7. data/{kharon-0.0.1.gem → dist/kharon-0.0.1.gem} +0 -0
  8. data/{kharon-0.0.2.gem → dist/kharon-0.0.2.gem} +0 -0
  9. data/{kharon-0.0.3.gem → dist/kharon-0.0.3.gem} +0 -0
  10. data/{kharon-0.1.0.gem → dist/kharon-0.1.0.gem} +0 -0
  11. data/{kharon-0.2.0.gem → dist/kharon-0.2.0.gem} +0 -0
  12. data/{kharon-0.3.0.gem → dist/kharon-0.3.0.gem} +0 -0
  13. data/{kharon-0.3.1.gem → dist/kharon-0.3.1.gem} +0 -0
  14. data/{kharon-0.4.0.gem → dist/kharon-0.4.0.gem} +0 -0
  15. data/{kharon-0.5.0.gem → dist/kharon-0.5.0.gem} +0 -0
  16. data/dist/kharon-0.5.1.gem +0 -0
  17. data/doc/Kharon.html +364 -0
  18. data/doc/Kharon/Configuration.html +452 -0
  19. data/doc/Kharon/Errors.html +145 -0
  20. data/doc/Kharon/Errors/Validation.html +436 -0
  21. data/doc/Kharon/Handlers.html +144 -0
  22. data/doc/Kharon/Handlers/Exceptions.html +273 -0
  23. data/doc/Kharon/Handlers/Messages.html +425 -0
  24. data/doc/Kharon/Helpers.html +277 -0
  25. data/doc/Kharon/Validator.html +1962 -0
  26. data/doc/_index.html +187 -0
  27. data/doc/class_list.html +58 -0
  28. data/doc/css/common.css +1 -0
  29. data/doc/css/full_list.css +57 -0
  30. data/doc/css/style.css +339 -0
  31. data/doc/file.README.html +415 -0
  32. data/doc/file.results.html +1578 -0
  33. data/doc/file_list.html +63 -0
  34. data/doc/frames.html +26 -0
  35. data/doc/index.html +415 -0
  36. data/doc/js/app.js +219 -0
  37. data/doc/js/full_list.js +181 -0
  38. data/doc/js/jquery.js +4 -0
  39. data/doc/method_list.html +207 -0
  40. data/doc/top-level-namespace.html +112 -0
  41. data/kharon.gemspec +9 -1
  42. data/lib/kharon.rb +7 -11
  43. data/lib/kharon/errors.rb +7 -0
  44. data/lib/kharon/errors/validation.rb +2 -0
  45. data/lib/kharon/handlers.rb +8 -0
  46. data/lib/kharon/handlers/exceptions.rb +3 -1
  47. data/lib/kharon/handlers/messages.rb +11 -4
  48. data/lib/kharon/validator.rb +17 -5
  49. data/lib/kharon/version.rb +2 -1
  50. data/spec/lib/kharon/handlers/messages_spec.rb +11 -0
  51. data/spec/lib/kharon/validator_spec.rb +6 -0
  52. data/spec/results.html +1506 -0
  53. metadata +140 -20
  54. data/lib/kharon/configuration.rb +0 -28
  55. data/lib/kharon/helpers/validate.rb +0 -15
@@ -0,0 +1,63 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html>
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+
7
+ <link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
8
+
9
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
10
+
11
+
12
+
13
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
16
+
17
+
18
+ <title>File List</title>
19
+ <base id="base_target" target="_parent" />
20
+ </head>
21
+ <body>
22
+ <script type="text/javascript" charset="utf-8">
23
+ var hasFrames = false;
24
+ try {
25
+ hasFrames = window.top.frames.main ? true : false;
26
+ } catch (e) { }
27
+ if (hasFrames) {
28
+ document.getElementById('base_target').target = 'main';
29
+ document.body.className = 'frames';
30
+ }
31
+ </script>
32
+ <div id="content">
33
+ <h1 id="full_list_header">File List</h1>
34
+ <div id="nav">
35
+
36
+ <span><a target="_self" href="class_list.html">
37
+ Classes
38
+ </a></span>
39
+
40
+ <span><a target="_self" href="method_list.html">
41
+ Methods
42
+ </a></span>
43
+
44
+ <span><a target="_self" href="file_list.html">
45
+ Files
46
+ </a></span>
47
+
48
+ </div>
49
+ <div id="search">Search: <input type="text" /></div>
50
+
51
+ <ul id="full_list" class="file">
52
+
53
+
54
+ <li class="r1"><span class="object_link"><a href="index.html" title="README">README</a></a></li>
55
+
56
+
57
+ <li class="r2"><span class="object_link"><a href="file.results.html" title="results">results</a></a></li>
58
+
59
+
60
+ </ul>
61
+ </div>
62
+ </body>
63
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7
+ <title>Documentation by YARD 0.8.7.6</title>
8
+ </head>
9
+ <script type="text/javascript" charset="utf-8">
10
+ window.onload = function() {
11
+ var match = unescape(window.location.hash).match(/^#!(.+)/);
12
+ var name = match ? match[1] : 'index.html';
13
+ name = name.replace(/^(\w+):\/\//, '').replace(/^\/\//, '');
14
+ document.writeln('<frameset cols="20%,*">' +
15
+ '<frame name="list" src="class_list.html" />' +
16
+ '<frame name="main" src="' + escape(name) + '" />' +
17
+ '</frameset>');
18
+ }
19
+ </script>
20
+ <noscript>
21
+ <frameset cols="20%,*">
22
+ <frame name="list" src="class_list.html" />
23
+ <frame name="main" src="index.html" />
24
+ </frameset>
25
+ </noscript>
26
+ </html>
@@ -0,0 +1,415 @@
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
+ File: README
8
+
9
+ &mdash; 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#!file.README.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</a> &raquo;
35
+ <span class="title">File: README</span>
36
+
37
+
38
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
39
+ </div>
40
+
41
+ <div id="search">
42
+
43
+ <a class="full_list_link" id="class_list_link"
44
+ href="class_list.html">
45
+ Class List
46
+ </a>
47
+
48
+ <a class="full_list_link" id="method_list_link"
49
+ href="method_list.html">
50
+ Method List
51
+ </a>
52
+
53
+ <a class="full_list_link" id="file_list_link"
54
+ href="file_list.html">
55
+ File List
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <iframe id="search_frame"></iframe>
63
+
64
+ <div id="content"><div id='filecontents'><h1>Kharon the boatkeeper</h1>
65
+
66
+ <h2>What is kharon ?</h2>
67
+
68
+ <p>Charon (or Khàrôn in ancient greek) was, in the greek mythology, the ferryman to cross the Styx river. He decided who passed, and who didn&#39;t pass, and it&#39;s exactly what this gem does.</p>
69
+
70
+ <p>It validates the datas in a hash given criterias about its keys, and let the execution of the program continue if the requirements are fulfilled, stop it if not. The datas in the hash are supposed to be strings, Kharon being designed to validate datas coming in a web application from the outside (tipically, datas passed in a querystring or a POST body).</p>
71
+
72
+ <h2>Contact me</h2>
73
+
74
+ <p>For any question or advice, contact me at <a href="mailto:courtois.vincent@outlook.com">courtois.vincent@outlook.com</a>. I&#39;ll answer as soon as possible, and thank you by advance for giving me some of your time.</p>
75
+
76
+ <h2>Requirements</h2>
77
+
78
+ <p>You&#39;ll just need Ruby 1.9.3 at least to make it work.</p>
79
+
80
+ <h2>Installation</h2>
81
+
82
+ <h3>From Rubygems.org</h3>
83
+
84
+ <p>It&#39;s a gem, you know how to install a gem, or you should if you&#39;re using it in a ruby application. Okay, let&#39;s consider you don&#39;t, just type :</p>
85
+
86
+ <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='id identifier rubyid_install'>install</span> <span class='id identifier rubyid_kharon'>kharon</span>
87
+ </code></pre>
88
+
89
+ <p>And... That&#39;s it ! Now it&#39;s installed and you can learn how to properly use it !</p>
90
+
91
+ <h3>With bundler</h3>
92
+
93
+ <p>Add it to your Gemfile :</p>
94
+
95
+ <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>kharon</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>&lt;version&gt;</span><span class='tstring_end'>&quot;</span></span>
96
+ </code></pre>
97
+
98
+ <p><version> being the version of the gem you want to install.</p>
99
+
100
+ <p>then run the following command :</p>
101
+
102
+ <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_bundle'>bundle</span> <span class='id identifier rubyid_install'>install</span>
103
+ </code></pre>
104
+
105
+ <h3>From sources</h3>
106
+
107
+ <p>Clone this repository whenether you want, go inside, then type the following command :</p>
108
+
109
+ <pre class="code ruby"><code class="ruby">gem install dist/kharon-&lt;version&gt;
110
+ </code></pre>
111
+
112
+ <p><version> being the version of the gem you want to install.</p>
113
+
114
+ <p>The gem will be installed on your system, from then on you can use it inside your applications.</p>
115
+
116
+ <h2>Configuration</h2>
117
+
118
+ <h3>Use exceptions or not use exceptions, that is the question</h3>
119
+
120
+ <p>In some cases you could want to not raise an exception each and every time an error occurs in the validation process. To stop using exceptions, just type :</p>
121
+
122
+ <pre class="code ruby"><code class="ruby"><span class='const'>Kharon</span><span class='period'>.</span><span class='id identifier rubyid_use_exceptions'>use_exceptions</span><span class='lparen'>(</span><span class='kw'>false</span><span class='rparen'>)</span>
123
+ </code></pre>
124
+
125
+ <p>and put it somewhere in your application, typically in a /config/initializers/kharon.rb file for a rails application.</p>
126
+
127
+ <p>You can put back the original behaviour by calling it and passing true as the first parameter, or no parameter, instead of false.</p>
128
+
129
+ <h2>Run tests</h2>
130
+
131
+ <p>This gem is tested using RSpec, to run the tests, clone the repository, go in, then type :</p>
132
+
133
+ <pre class="code ruby"><code class="ruby">% bundle install
134
+ % bundle exec rspec
135
+ </code></pre>
136
+
137
+ <h2>How to use the gem</h2>
138
+
139
+ <p>First, you need to include the gem to your application. Usually you can just do :</p>
140
+
141
+ <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>kharon</span><span class='tstring_end'>&quot;</span></span>
142
+ </code></pre>
143
+
144
+ <h3>The validator</h3>
145
+
146
+ <p>The Kharon::Validator class is the main class of this gem, it offers an interface to validate hashes and see if they fulfill requirements. first, you have to create an instance of the validator :</p>
147
+
148
+ <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_validator'>validator</span> <span class='op'>=</span> <span class='const'>Kharon</span><span class='op'>::</span><span class='const'>Validator</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_hash_to_validate'>hash_to_validate</span><span class='rparen'>)</span>
149
+ </code></pre>
150
+
151
+ <p>Now your validator knows which hash it has to validate, now you can do :</p>
152
+
153
+ <pre class="code ruby"><code class="ruby"><span class='comment'># Sees if the &quot;required_integer_key&quot; key is present, and an integer
154
+ </span><span class='id identifier rubyid_validator'>validator</span><span class='period'>.</span><span class='id identifier rubyid_integer'>integer</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>required_integer_key</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>required:</span> <span class='kw'>true</span><span class='rparen'>)</span>
155
+ </code></pre>
156
+
157
+ <p>All the functions are listed in the full documentation below.</p>
158
+
159
+ <h3>The helper</h3>
160
+
161
+ <p>This gem was firstly designed to be used as a helper for Sinatra applications, so it contains another useful module : Kharon::Helpers. To use it in your Sinatra application, just type this in the controllers where you want it included :</p>
162
+
163
+ <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_helpers'>helpers</span> <span class='const'>Kharon</span><span class='op'>::</span><span class='const'>Helpers</span>
164
+ </code></pre>
165
+
166
+ <p>From there, you can type it in any of the routes of this controller :</p>
167
+
168
+ <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_validate'>validate</span><span class='lparen'>(</span><span class='id identifier rubyid_hash_to_validate'>hash_to_validate</span><span class='rparen'>)</span> <span class='kw'>do</span>
169
+ <span class='id identifier rubyid_integer'>integer</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>required_integer_key</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>required:</span> <span class='kw'>true</span>
170
+ <span class='kw'>end</span>
171
+ </code></pre>
172
+
173
+ <p>This code is strictly equivalent to the one presented above, it uses the block syntax of ruby to give you a nice and fancy way to validate your datas !</p>
174
+
175
+ <h2>Full documentation</h2>
176
+
177
+ <h3>Generated documentation</h3>
178
+
179
+ <p>Generated documentation can be displayed by displaying the doc/index.html file in a browser.</p>
180
+
181
+ <h3>Methods</h3>
182
+
183
+ <p>Methods signification are pretty straight-forward as it validates type :</p>
184
+
185
+ <ul>
186
+ <li>:integer</li>
187
+ <li>:numeric</li>
188
+ <li>:text</li>
189
+ <li>:any</li>
190
+ <li>:datetime</li>
191
+ <li>:date</li>
192
+ <li>:array</li>
193
+ <li>:hash</li>
194
+ <li>:boolean</li>
195
+ <li>:mongoid</li>
196
+ </ul>
197
+
198
+ <h4>:any</h4>
199
+
200
+ <p>This method will validate any value associated to the given key, it&#39;s useful if you just want to pass options like :required or :dependency without checking for a particular type.</p>
201
+
202
+ <h4>:mongoid</h4>
203
+
204
+ <p>This method is only useful if you use Mongoid or an ORM linking MongoDB to your application. It validates the data associated with the key only if it&#39;s a string formatted as a MongoDB unique identifier.</p>
205
+
206
+ <h3>Options</h3>
207
+
208
+ <h4>:required</h4>
209
+
210
+ <p>This option can be given to say that a key has to be in the hash for it to be validated. It can be used with all methods.</p>
211
+
212
+ <h4>:dependency</h4>
213
+
214
+ <p>This option says that this key needs another key to be present for the hash to be validated. It can be used with all methods.</p>
215
+
216
+ <h4>:dependencies</h4>
217
+
218
+ <p>This options is used to pass several dependecies at once, as an array of keys. See :dependency option for details. It can be used with all methods.
219
+ Note: the :dependencies option <em>overrides</em> the :dependency option if both are given.</p>
220
+
221
+ <h4>:in</h4>
222
+
223
+ <p>This option is used to give an array of possible values for the given key. If the value of the key is not in thius array, the validator fails. It can be used with all methods.</p>
224
+
225
+ <h4>:equals</h4>
226
+
227
+ <p>For the value of a given key in the hash to be equal to the given value. It can be used with all methods.</p>
228
+
229
+ <h4>:min</h4>
230
+
231
+ <p>This option allows you to specify a non-strict minimum limit for the value associated with the given key. The value has to be passed as an integer. It can be used with :numeric or :integer methods.</p>
232
+
233
+ <h4>:max</h4>
234
+
235
+ <p>This option allows you to specify a non-strict maximum limit for the value associated with the given key. The value has to be passed as an integer. It can be used with :numeric or :integer methods.</p>
236
+
237
+ <h4>:between</h4>
238
+
239
+ <p>This option gives an interval in which the value of the given key must be to fulfill the requirement. The value has to be passed as an array of two integers, first the minimum, then the maximum. It can be used with :numeric or :integer methods.
240
+ Note: the :between option <em>overrides</em> the :min <em>and</em> :max options if several are given.</p>
241
+
242
+ <h4>:contains</h4>
243
+
244
+ <p>This option is used to see if an array or a hash situated at the given key contains some values. The values must be passed as an array. This option can be used with the :hash and :array methods.</p>
245
+
246
+ <h4>:has_keys</h4>
247
+
248
+ <p>This option is used to see if a hash situated at the given key contains some keys. The values must be passed as an array. This option can be used with the :hash and :array methods.</p>
249
+
250
+ <h4>:cast</h4>
251
+
252
+ <p>This option, if not given, is set to TRUE. If given at false, doesn&#39;t type cast the result of the validation so you keep the original string and just check its type. It can be used with all methods.</p>
253
+
254
+ <h4>:extract</h4>
255
+
256
+ <p>This option, if not given, is set to TRUE. If given at false, doesn&#39;t extract the given key, just validate its type. It can be used with all methods.</p>
257
+
258
+ <h4>:floor</h4>
259
+
260
+ <p>If given and TRUE, floors the decimal number identified by this key. This option can be used with the :numeric method.</p>
261
+
262
+ <h4>:ceil</h4>
263
+
264
+ <p>If given and TRUE, ceils the decimal number identified by this key. This option can be used with the :numeric method.</p>
265
+
266
+ <h4>:round</h4>
267
+
268
+ <p>If given, as an integer, rounds the decimal number keeping the given number of digits after the comma ; if given as a boolean, rounds the decimal number, leaving no decimal digits. This option can be used with the :numeric method.</p>
269
+
270
+ <h4>:regex</h4>
271
+
272
+ <p>The value of this option must be passed as a string. If given as a string, verity that the associated string matches the given regular expression. This option can be used with the :text method.</p>
273
+
274
+ <h4>:at_most</h4>
275
+
276
+ <p>The value of this option must be passed as a box. When given, this option indicates the maximum value for the associated box. The associated box can&#39;t cross any of these coordinates.</p>
277
+
278
+ <h4>:at_least</h4>
279
+
280
+ <p>The value of this option must be passed as a box. When given, this option indicates the minimum value for the associated box. The associated box can&#39;t be tinier than the given box.</p>
281
+
282
+ <h3>Errors formats</h3>
283
+
284
+ <p>In Kharon, errors are formatted in a particular way. Each error contains a hash (or associative array) describing its type, and giving special caracteristics if necessary.</p>
285
+
286
+ <h4>Type error</h4>
287
+
288
+ <p>The most common error. It&#39;s raised when a type is expected for a key, and the given type for this key is different. It&#39;s formatted as followed :</p>
289
+
290
+ <ul>
291
+ <li>type : always has the value &quot;type&quot;</li>
292
+ <li>key : the key concerned by the error in the validated hash</li>
293
+ <li>supposed : the type of which the value associated with the key is supposed to be</li>
294
+ <li>given : the type effectively given for the value associated with the key</li>
295
+ </ul>
296
+
297
+ <h4>required error</h4>
298
+
299
+ <p>This error is raised when a key was required in the validated hash, but was not given. It&#39;s formatted as followed :</p>
300
+
301
+ <ul>
302
+ <li>type : always has the value &quot;required&quot;</li>
303
+ <li>key : the required, but not provided, key</li>
304
+ </ul>
305
+
306
+ <h4>dependency error</h4>
307
+
308
+ <p>This error is raised when a dependency was needed, but not provided, for a key. It&#39;s formatted as followed :</p>
309
+
310
+ <ul>
311
+ <li>type : always has the value &quot;dependency&quot;</li>
312
+ <li>key : the key needing another key to properly work</li>
313
+ <li>dependency : the needed, but not provided, dependency</li>
314
+ </ul>
315
+
316
+ <h4>min/max error</h4>
317
+
318
+ <p>This error is raised when a key must have a minimum or maximum value, but the provided value is below the minimum or above the maximum. It&#39;s formatted as followed :</p>
319
+
320
+ <ul>
321
+ <li>type : has either &quot;min&quot; or &quot;max&quot; value</li>
322
+ <li>supposed : the maximum or minimum value the provided value mustn&#39;t exceed</li>
323
+ <li>key : the key concerned byt the error</li>
324
+ <li>value : the value not respecting the minimum or maximum asked</li>
325
+ </ul>
326
+
327
+ <h4>in_array error</h4>
328
+
329
+ <p>This error is raised when the value associated with a key should belong to a range of values, and doesn&#39;t. It&#39;s formatted as followed :</p>
330
+
331
+ <ul>
332
+ <li>type : always has the &quot;array.in&quot; value</li>
333
+ <li>key : the key concerned byt the error</li>
334
+ <li>supposed : the range of values in which the value associated with the key should belong to</li>
335
+ <li>value : the value provided with the key</li>
336
+ </ul>
337
+
338
+ <h4>equals error</h4>
339
+
340
+ <p>This error is raised when the value associated to a key was expected to be equal to a value, but wasn&#39;t. It&#39;s formatted as followed :</p>
341
+
342
+ <ul>
343
+ <li>type : always has the &quot;equals&quot; value</li>
344
+ <li>key : the key concerned byt the error</li>
345
+ <li>supposed : the value the key was supposed to have</li>
346
+ <li>value : the effective value associated to the key</li>
347
+ </ul>
348
+
349
+ <h4>contains keys error</h4>
350
+
351
+ <p>This error is raised when a key, which type is a hash, doesn&#39;t contain the provided values as keys. It&#39;s formatted as followed :</p>
352
+
353
+ <ul>
354
+ <li>type : always has the &quot;contains.keys&quot; value</li>
355
+ <li>key : the key concerned byt the error</li>
356
+ <li>required : the keys that must be contained in the value hash</li>
357
+ <li>value : the hash provided with the validated key</li>
358
+ </ul>
359
+
360
+ <h4>contains values error</h4>
361
+
362
+ <p>This error is raised when a key, which type is an array or a hash, doesn&#39;t contain the provided values. It&#39;s formatted as followed :</p>
363
+
364
+ <ul>
365
+ <li>type : always has the &quot;contains.values&quot; value</li>
366
+ <li>key : the key concerned byt the error</li>
367
+ <li>required : the values that must be contained in the value hash</li>
368
+ <li>value : the hash provided with the validated key</li>
369
+ </ul>
370
+
371
+ <h4>regex error</h4>
372
+
373
+ <p>This error is raised when a value was expecting to respect a regular expression, but didn&#39;t. It&#39;s formatted as followed :</p>
374
+
375
+ <ul>
376
+ <li>type : always has the &quot;regex&quot; value</li>
377
+ <li>key : the key concerned by the error</li>
378
+ <li>regex : the regular expression expected to be respected</li>
379
+ <li>value : the effective value not respecting the regular expression</li>
380
+ </ul>
381
+
382
+ <h4>box format error</h4>
383
+
384
+ <p>This error is raised when a geographic box is not well formatted. It&#39;s formatted as followed :</p>
385
+
386
+ <ul>
387
+ <li>type : always has the &quot;box.format&quot; value</li>
388
+ <li>key : the key concerned by the error</li>
389
+ <li>value : the effective value of the box, not respecting the format of a box</li>
390
+ </ul>
391
+
392
+ <h4>box containment error</h4>
393
+
394
+ <p>This error is raised when a given key, as a box, is not contained in the box it should be (with the :at_most and :at_least options). It&#39;s formatted as followed :</p>
395
+
396
+ <ul>
397
+ <li>type : always has the &quot;box.containment&quot; value</li>
398
+ <li>key : the key concerned by the error</li>
399
+ <li>container : the box whithin which the contained box must be</li>
400
+ <li>contained : the box that must be contained in the container</li>
401
+ </ul>
402
+
403
+ <h3>Does it work ?</h3>
404
+
405
+ <p>Yes, it works, unit tests results can be found here : <a href="file.results.html" title="results of unit tests">results of unit tests</a></p>
406
+ </div></div>
407
+
408
+ <div id="footer">
409
+ Generated on Tue Sep 15 10:54:07 2015 by
410
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
411
+ 0.8.7.6 (ruby-1.9.3).
412
+ </div>
413
+
414
+ </body>
415
+ </html>