kharon 0.5.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +1 -0
- data/.rspec +2 -1
- data/Gemfile +1 -10
- data/Gemfile.lock +29 -16
- data/README.md +135 -26
- data/{kharon-0.0.1.gem → dist/kharon-0.0.1.gem} +0 -0
- data/{kharon-0.0.2.gem → dist/kharon-0.0.2.gem} +0 -0
- data/{kharon-0.0.3.gem → dist/kharon-0.0.3.gem} +0 -0
- data/{kharon-0.1.0.gem → dist/kharon-0.1.0.gem} +0 -0
- data/{kharon-0.2.0.gem → dist/kharon-0.2.0.gem} +0 -0
- data/{kharon-0.3.0.gem → dist/kharon-0.3.0.gem} +0 -0
- data/{kharon-0.3.1.gem → dist/kharon-0.3.1.gem} +0 -0
- data/{kharon-0.4.0.gem → dist/kharon-0.4.0.gem} +0 -0
- data/{kharon-0.5.0.gem → dist/kharon-0.5.0.gem} +0 -0
- data/dist/kharon-0.5.1.gem +0 -0
- data/doc/Kharon.html +364 -0
- data/doc/Kharon/Configuration.html +452 -0
- data/doc/Kharon/Errors.html +145 -0
- data/doc/Kharon/Errors/Validation.html +436 -0
- data/doc/Kharon/Handlers.html +144 -0
- data/doc/Kharon/Handlers/Exceptions.html +273 -0
- data/doc/Kharon/Handlers/Messages.html +425 -0
- data/doc/Kharon/Helpers.html +277 -0
- data/doc/Kharon/Validator.html +1962 -0
- data/doc/_index.html +187 -0
- data/doc/class_list.html +58 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +339 -0
- data/doc/file.README.html +415 -0
- data/doc/file.results.html +1578 -0
- data/doc/file_list.html +63 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +415 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +181 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +207 -0
- data/doc/top-level-namespace.html +112 -0
- data/kharon.gemspec +9 -1
- data/lib/kharon.rb +7 -11
- data/lib/kharon/errors.rb +7 -0
- data/lib/kharon/errors/validation.rb +2 -0
- data/lib/kharon/handlers.rb +8 -0
- data/lib/kharon/handlers/exceptions.rb +3 -1
- data/lib/kharon/handlers/messages.rb +11 -4
- data/lib/kharon/validator.rb +17 -5
- data/lib/kharon/version.rb +2 -1
- data/spec/lib/kharon/handlers/messages_spec.rb +11 -0
- data/spec/lib/kharon/validator_spec.rb +6 -0
- data/spec/results.html +1506 -0
- metadata +140 -20
- data/lib/kharon/configuration.rb +0 -28
- data/lib/kharon/helpers/validate.rb +0 -15
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NzczMmFkMWJhZGQ5ODMwN2NjYTE2YTE0N2IxMGQzYWEzNmNiZjRmYg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
OTc5ZTY2MDUyOTQ0MTU4MWY4NGMxMjRlOTE4NzkyNzE5MTMxYTE3Mw==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MzZhNDIxNjY3ODI4NWY5NzA4NTU2NzZkY2QzNzJkYjI3NjM1YTI0YThiNjEz
|
10
|
+
NmFiNzM0NjQ1YzE1OTA5ZjQ1MjM1N2Y5YWFjODk4MTcwODMyMTIwMWRlZjlk
|
11
|
+
MzE1ZWIzZjhkYWYzZWZjNWM1ODdjODc5MmJiZjM0MmQ0OWE0ZGY=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MmNjNGU0OTlhMGI5MTBmYWI4Yzg2NGY2N2ZiZmVjMzJlNmJjODFjNjAyZDc2
|
14
|
+
YzljNjc1N2QyM2U5NGRmNDY5MmRkZTIzMWUyMGY4ODMzOWJhZTQ1NmFjYzQz
|
15
|
+
YWE1Mzc3OWU1N2NmMGNhZTMwMjExZmJlNDFjYzM3ZWUyZTlhYzg=
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
.yardoc
|
data/.rspec
CHANGED
data/Gemfile
CHANGED
@@ -1,10 +1 @@
|
|
1
|
-
|
2
|
-
ruby "1.9.3"
|
3
|
-
|
4
|
-
gem "bson", "2.2.2"
|
5
|
-
|
6
|
-
# These gems are only used for testing purposes, and shouldn't be used in another environment than the local development one.
|
7
|
-
group :test do
|
8
|
-
gem "rack-test", "0.6.2"
|
9
|
-
gem "rspec" , "3.0.0.beta2"
|
10
|
-
end
|
1
|
+
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,28 +1,41 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
kharon (1.1.0)
|
5
|
+
bson (~> 2.2, >= 2.2.2)
|
6
|
+
|
1
7
|
GEM
|
2
8
|
remote: https://rubygems.org/
|
3
9
|
specs:
|
4
|
-
bson (2.
|
10
|
+
bson (2.3.0)
|
5
11
|
diff-lcs (1.2.5)
|
6
|
-
rack (1.
|
12
|
+
rack (1.6.1)
|
7
13
|
rack-test (0.6.2)
|
8
14
|
rack (>= 1.0)
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
rspec-
|
13
|
-
|
14
|
-
rspec-
|
15
|
-
rspec-
|
15
|
+
rake (10.4.2)
|
16
|
+
redcarpet (3.3.1)
|
17
|
+
rspec (3.1.0)
|
18
|
+
rspec-core (~> 3.1.0)
|
19
|
+
rspec-expectations (~> 3.1.0)
|
20
|
+
rspec-mocks (~> 3.1.0)
|
21
|
+
rspec-core (3.1.7)
|
22
|
+
rspec-support (~> 3.1.0)
|
23
|
+
rspec-expectations (3.1.2)
|
16
24
|
diff-lcs (>= 1.2.0, < 2.0)
|
17
|
-
rspec-support (
|
18
|
-
rspec-mocks (3.
|
19
|
-
rspec-support (
|
20
|
-
rspec-support (3.
|
25
|
+
rspec-support (~> 3.1.0)
|
26
|
+
rspec-mocks (3.1.3)
|
27
|
+
rspec-support (~> 3.1.0)
|
28
|
+
rspec-support (3.1.2)
|
29
|
+
yard (0.8.7.6)
|
21
30
|
|
22
31
|
PLATFORMS
|
23
32
|
ruby
|
24
33
|
|
25
34
|
DEPENDENCIES
|
26
|
-
|
27
|
-
|
28
|
-
|
35
|
+
bundler (~> 1.8)
|
36
|
+
kharon!
|
37
|
+
rack-test (~> 0.6.2)
|
38
|
+
rake (~> 10.0)
|
39
|
+
redcarpet (= 3.3.1)
|
40
|
+
rspec (~> 3.0, >= 3.0.0)
|
41
|
+
yard (~> 0.8)
|
data/README.md
CHANGED
@@ -8,7 +8,7 @@ It validates the datas in a hash given criterias about its keys, and let the exe
|
|
8
8
|
|
9
9
|
## Contact me
|
10
10
|
|
11
|
-
For any question or advice, contact me at vincent
|
11
|
+
For any question or advice, contact me at courtois.vincent@outlook.com. I'll answer as soon as possible, and thank you by advance for giving me some of your time.
|
12
12
|
|
13
13
|
## Requirements
|
14
14
|
|
@@ -31,9 +31,11 @@ And... That's it ! Now it's installed and you can learn how to properly use it !
|
|
31
31
|
Add it to your Gemfile :
|
32
32
|
|
33
33
|
```
|
34
|
-
gem "kharon", "
|
34
|
+
gem "kharon", "<version>"
|
35
35
|
```
|
36
36
|
|
37
|
+
<version> being the version of the gem you want to install.
|
38
|
+
|
37
39
|
then run the following command :
|
38
40
|
|
39
41
|
```
|
@@ -45,29 +47,34 @@ bundle install
|
|
45
47
|
Clone this repository whenether you want, go inside, then type the following command :
|
46
48
|
|
47
49
|
```
|
48
|
-
gem install kharon
|
50
|
+
gem install dist/kharon-<version>
|
49
51
|
```
|
50
52
|
|
53
|
+
<version> being the version of the gem you want to install.
|
54
|
+
|
51
55
|
The gem will be installed on your system, from then on you can use it inside your applications.
|
52
56
|
|
53
57
|
## Configuration
|
54
58
|
|
55
|
-
|
59
|
+
### Use exceptions or not use exceptions, that is the question
|
56
60
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
end
|
61
|
+
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 :
|
62
|
+
|
63
|
+
```
|
64
|
+
Kharon.use_exceptions(false)
|
62
65
|
```
|
63
66
|
|
67
|
+
and put it somewhere in your application, typically in a /config/initializers/kharon.rb file for a rails application.
|
68
|
+
|
69
|
+
You can put back the original behaviour by calling it and passing true as the first parameter, or no parameter, instead of false.
|
70
|
+
|
64
71
|
## Run tests
|
65
72
|
|
66
73
|
This gem is tested using RSpec, to run the tests, clone the repository, go in, then type :
|
67
74
|
|
68
75
|
```
|
69
76
|
% bundle install
|
70
|
-
% bundle exec rspec
|
77
|
+
% bundle exec rspec
|
71
78
|
```
|
72
79
|
|
73
80
|
## How to use the gem
|
@@ -83,7 +90,7 @@ require "kharon"
|
|
83
90
|
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 :
|
84
91
|
|
85
92
|
```ruby
|
86
|
-
validator = Kharon::
|
93
|
+
validator = Kharon::Validator.new(hash_to_validate)
|
87
94
|
```
|
88
95
|
|
89
96
|
Now your validator knows which hash it has to validate, now you can do :
|
@@ -115,9 +122,14 @@ This code is strictly equivalent to the one presented above, it uses the block s
|
|
115
122
|
|
116
123
|
## Full documentation
|
117
124
|
|
125
|
+
### Generated documentation
|
126
|
+
|
127
|
+
Generated documentation can be displayed by displaying the doc/index.html file in a browser.
|
128
|
+
|
118
129
|
### Methods
|
119
130
|
|
120
131
|
Methods signification are pretty straight-forward as it validates type :
|
132
|
+
|
121
133
|
- :integer
|
122
134
|
- :numeric
|
123
135
|
- :text
|
@@ -131,7 +143,7 @@ Methods signification are pretty straight-forward as it validates type :
|
|
131
143
|
|
132
144
|
#### :any
|
133
145
|
|
134
|
-
This method will validate any value associated to the given key, it's useful if you just want to pass options like :required or :dependency
|
146
|
+
This method will validate any value associated to the given key, it's useful if you just want to pass options like :required or :dependency without checking for a particular type.
|
135
147
|
|
136
148
|
#### :mongoid
|
137
149
|
|
@@ -145,7 +157,7 @@ This option can be given to say that a key has to be in the hash for it to be va
|
|
145
157
|
|
146
158
|
#### :dependency
|
147
159
|
|
148
|
-
This
|
160
|
+
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.
|
149
161
|
|
150
162
|
#### :dependencies
|
151
163
|
|
@@ -191,30 +203,127 @@ This option, if not given, is set to TRUE. If given at false, doesn't extract th
|
|
191
203
|
|
192
204
|
#### :floor
|
193
205
|
|
194
|
-
|
206
|
+
If given and TRUE, floors the decimal number identified by this key. This option can be used with the :numeric method.
|
195
207
|
|
196
208
|
#### :ceil
|
197
209
|
|
198
|
-
|
210
|
+
If given and TRUE, ceils the decimal number identified by this key. This option can be used with the :numeric method.
|
199
211
|
|
200
212
|
#### :round
|
201
213
|
|
202
|
-
|
214
|
+
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.
|
203
215
|
|
204
216
|
#### :regex
|
205
217
|
|
206
218
|
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.
|
207
219
|
|
208
|
-
|
220
|
+
#### :at_most
|
209
221
|
|
210
|
-
|
222
|
+
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't cross any of these coordinates.
|
211
223
|
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
224
|
+
#### :at_least
|
225
|
+
|
226
|
+
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't be tinier than the given box.
|
227
|
+
|
228
|
+
### Errors formats
|
229
|
+
|
230
|
+
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.
|
231
|
+
|
232
|
+
#### Type error
|
233
|
+
|
234
|
+
The most common error. It's raised when a type is expected for a key, and the given type for this key is different. It's formatted as followed :
|
235
|
+
|
236
|
+
- type : always has the value "type"
|
237
|
+
- key : the key concerned by the error in the validated hash
|
238
|
+
- supposed : the type of which the value associated with the key is supposed to be
|
239
|
+
- given : the type effectively given for the value associated with the key
|
240
|
+
|
241
|
+
#### required error
|
242
|
+
|
243
|
+
This error is raised when a key was required in the validated hash, but was not given. It's formatted as followed :
|
244
|
+
|
245
|
+
- type : always has the value "required"
|
246
|
+
- key : the required, but not provided, key
|
247
|
+
|
248
|
+
#### dependency error
|
249
|
+
|
250
|
+
This error is raised when a dependency was needed, but not provided, for a key. It's formatted as followed :
|
251
|
+
|
252
|
+
- type : always has the value "dependency"
|
253
|
+
- key : the key needing another key to properly work
|
254
|
+
- dependency : the needed, but not provided, dependency
|
255
|
+
|
256
|
+
#### min/max error
|
257
|
+
|
258
|
+
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's formatted as followed :
|
259
|
+
|
260
|
+
- type : has either "min" or "max" value
|
261
|
+
- supposed : the maximum or minimum value the provided value mustn't exceed
|
262
|
+
- key : the key concerned byt the error
|
263
|
+
- value : the value not respecting the minimum or maximum asked
|
264
|
+
|
265
|
+
#### in_array error
|
266
|
+
|
267
|
+
This error is raised when the value associated with a key should belong to a range of values, and doesn't. It's formatted as followed :
|
268
|
+
|
269
|
+
- type : always has the "array.in" value
|
270
|
+
- key : the key concerned byt the error
|
271
|
+
- supposed : the range of values in which the value associated with the key should belong to
|
272
|
+
- value : the value provided with the key
|
273
|
+
|
274
|
+
#### equals error
|
275
|
+
|
276
|
+
This error is raised when the value associated to a key was expected to be equal to a value, but wasn't. It's formatted as followed :
|
277
|
+
|
278
|
+
- type : always has the "equals" value
|
279
|
+
- key : the key concerned byt the error
|
280
|
+
- supposed : the value the key was supposed to have
|
281
|
+
- value : the effective value associated to the key
|
282
|
+
|
283
|
+
#### contains keys error
|
284
|
+
|
285
|
+
This error is raised when a key, which type is a hash, doesn't contain the provided values as keys. It's formatted as followed :
|
286
|
+
|
287
|
+
- type : always has the "contains.keys" value
|
288
|
+
- key : the key concerned byt the error
|
289
|
+
- required : the keys that must be contained in the value hash
|
290
|
+
- value : the hash provided with the validated key
|
291
|
+
|
292
|
+
#### contains values error
|
293
|
+
|
294
|
+
This error is raised when a key, which type is an array or a hash, doesn't contain the provided values. It's formatted as followed :
|
295
|
+
|
296
|
+
- type : always has the "contains.values" value
|
297
|
+
- key : the key concerned byt the error
|
298
|
+
- required : the values that must be contained in the value hash
|
299
|
+
- value : the hash provided with the validated key
|
300
|
+
|
301
|
+
#### regex error
|
302
|
+
|
303
|
+
This error is raised when a value was expecting to respect a regular expression, but didn't. It's formatted as followed :
|
304
|
+
|
305
|
+
- type : always has the "regex" value
|
306
|
+
- key : the key concerned by the error
|
307
|
+
- regex : the regular expression expected to be respected
|
308
|
+
- value : the effective value not respecting the regular expression
|
309
|
+
|
310
|
+
#### box format error
|
311
|
+
|
312
|
+
This error is raised when a geographic box is not well formatted. It's formatted as followed :
|
313
|
+
|
314
|
+
- type : always has the "box.format" value
|
315
|
+
- key : the key concerned by the error
|
316
|
+
- value : the effective value of the box, not respecting the format of a box
|
317
|
+
|
318
|
+
#### box containment error
|
319
|
+
|
320
|
+
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's formatted as followed :
|
321
|
+
|
322
|
+
- type : always has the "box.containment" value
|
323
|
+
- key : the key concerned by the error
|
324
|
+
- container : the box whithin which the contained box must be
|
325
|
+
- contained : the box that must be contained in the container
|
326
|
+
|
327
|
+
### Does it work ?
|
219
328
|
|
220
|
-
|
329
|
+
Yes, it works, unit tests results can be found here : {file:doc/results.html results of unit tests}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
Binary file
|
data/doc/Kharon.html
ADDED
@@ -0,0 +1,364 @@
|
|
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
|
+
Module: Kharon
|
8
|
+
|
9
|
+
— 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#!Kharon.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 (K)</a> »
|
35
|
+
|
36
|
+
|
37
|
+
<span class="title">Kharon</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Module: Kharon
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<dt class="r1 last">Defined in:</dt>
|
82
|
+
<dd class="r1 last">lib/kharon.rb<span class="defines">,<br />
|
83
|
+
lib/kharon/errors.rb,<br /> lib/kharon/version.rb,<br /> lib/kharon/handlers.rb,<br /> lib/kharon/validator.rb,<br /> lib/kharon/errors/validation.rb,<br /> lib/kharon/handlers/messages.rb,<br /> lib/kharon/handlers/exceptions.rb</span>
|
84
|
+
</dd>
|
85
|
+
|
86
|
+
</dl>
|
87
|
+
<div class="clear"></div>
|
88
|
+
|
89
|
+
<h2>Overview</h2><div class="docstring">
|
90
|
+
<div class="discussion">
|
91
|
+
|
92
|
+
<p>Main module of the application.</p>
|
93
|
+
|
94
|
+
|
95
|
+
</div>
|
96
|
+
</div>
|
97
|
+
<div class="tags">
|
98
|
+
|
99
|
+
<p class="tag_title">Author:</p>
|
100
|
+
<ul class="author">
|
101
|
+
|
102
|
+
<li>
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
<div class='inline'>
|
109
|
+
<p>Vincent Courtois <courtois.vincent@outlook.com></p>
|
110
|
+
</div>
|
111
|
+
|
112
|
+
</li>
|
113
|
+
|
114
|
+
</ul>
|
115
|
+
|
116
|
+
</div><h2>Defined Under Namespace</h2>
|
117
|
+
<p class="children">
|
118
|
+
|
119
|
+
|
120
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Kharon/Errors.html" title="Kharon::Errors (module)">Errors</a></span>, <span class='object_link'><a href="Kharon/Handlers.html" title="Kharon::Handlers (module)">Handlers</a></span>
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Kharon/Validator.html" title="Kharon::Validator (class)">Validator</a></span>
|
125
|
+
|
126
|
+
|
127
|
+
</p>
|
128
|
+
|
129
|
+
<h2>Constant Summary</h2>
|
130
|
+
|
131
|
+
<dl class="constants">
|
132
|
+
|
133
|
+
<dt id="VERSION-constant" class="">VERSION =
|
134
|
+
<div class="docstring">
|
135
|
+
<div class="discussion">
|
136
|
+
|
137
|
+
<p>Current version of the application.</p>
|
138
|
+
|
139
|
+
|
140
|
+
</div>
|
141
|
+
</div>
|
142
|
+
<div class="tags">
|
143
|
+
|
144
|
+
|
145
|
+
</div>
|
146
|
+
</dt>
|
147
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>1.1.0</span><span class='tstring_end'>"</span></span></pre></dd>
|
148
|
+
|
149
|
+
<dt id="use_exceptions-classvariable" class="">@@use_exceptions =
|
150
|
+
|
151
|
+
</dt>
|
152
|
+
<dd><pre class="code"><span class='kw'>true</span></pre></dd>
|
153
|
+
|
154
|
+
</dl>
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
<h2>
|
165
|
+
Class Method Summary
|
166
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
167
|
+
</h2>
|
168
|
+
|
169
|
+
<ul class="summary">
|
170
|
+
|
171
|
+
<li class="public ">
|
172
|
+
<span class="summary_signature">
|
173
|
+
|
174
|
+
<a href="#errors_handler-class_method" title="errors_handler (class method)">+ (Object) <strong>errors_handler</strong> </a>
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
</span>
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
<span class="summary_desc"><div class='inline'>
|
189
|
+
<p>Returns the current error handler, defined by if you use exceptions or not.</p>
|
190
|
+
</div></span>
|
191
|
+
|
192
|
+
</li>
|
193
|
+
|
194
|
+
|
195
|
+
<li class="public ">
|
196
|
+
<span class="summary_signature">
|
197
|
+
|
198
|
+
<a href="#use_exceptions-class_method" title="use_exceptions (class method)">+ (Object) <strong>use_exceptions</strong>(use = true) </a>
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
</span>
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
<span class="summary_desc"><div class='inline'>
|
213
|
+
<p>Configuration method used to tell the module if it uses exceptions or
|
214
|
+
stores error messages.</p>
|
215
|
+
</div></span>
|
216
|
+
|
217
|
+
</li>
|
218
|
+
|
219
|
+
|
220
|
+
</ul>
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
<div id="class_method_details" class="method_details_list">
|
226
|
+
<h2>Class Method Details</h2>
|
227
|
+
|
228
|
+
|
229
|
+
<div class="method_details first">
|
230
|
+
<h3 class="signature first" id="errors_handler-class_method">
|
231
|
+
|
232
|
+
+ (<tt>Object</tt>) <strong>errors_handler</strong>
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
</h3><div class="docstring">
|
239
|
+
<div class="discussion">
|
240
|
+
|
241
|
+
<p>Returns the current error handler, defined by if you use exceptions or not.</p>
|
242
|
+
|
243
|
+
|
244
|
+
</div>
|
245
|
+
</div>
|
246
|
+
<div class="tags">
|
247
|
+
|
248
|
+
<p class="tag_title">Returns:</p>
|
249
|
+
<ul class="return">
|
250
|
+
|
251
|
+
<li>
|
252
|
+
|
253
|
+
|
254
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
—
|
259
|
+
<div class='inline'>
|
260
|
+
<p>an instance of Kharon::Handlers::Exceptions if you use exceptions, an
|
261
|
+
instance of Kharon::Handlers::Messages else.</p>
|
262
|
+
</div>
|
263
|
+
|
264
|
+
</li>
|
265
|
+
|
266
|
+
</ul>
|
267
|
+
|
268
|
+
</div><table class="source_code">
|
269
|
+
<tr>
|
270
|
+
<td>
|
271
|
+
<pre class="lines">
|
272
|
+
|
273
|
+
|
274
|
+
17
|
275
|
+
18
|
276
|
+
19</pre>
|
277
|
+
</td>
|
278
|
+
<td>
|
279
|
+
<pre class="code"><span class="info file"># File 'lib/kharon.rb', line 17</span>
|
280
|
+
|
281
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_errors_handler'>errors_handler</span>
|
282
|
+
<span class='cvar'>@@use_exceptions</span> <span class='op'>?</span> <span class='const'>Kharon</span><span class='op'>::</span><span class='const'>Handlers</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span> <span class='op'>:</span> <span class='const'>Kharon</span><span class='op'>::</span><span class='const'>Handlers</span><span class='op'>::</span><span class='const'>Messages</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
283
|
+
<span class='kw'>end</span></pre>
|
284
|
+
</td>
|
285
|
+
</tr>
|
286
|
+
</table>
|
287
|
+
</div>
|
288
|
+
|
289
|
+
<div class="method_details ">
|
290
|
+
<h3 class="signature " id="use_exceptions-class_method">
|
291
|
+
|
292
|
+
+ (<tt>Object</tt>) <strong>use_exceptions</strong>(use = true)
|
293
|
+
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
|
298
|
+
</h3><div class="docstring">
|
299
|
+
<div class="discussion">
|
300
|
+
|
301
|
+
<p>Configuration method used to tell the module if it uses exceptions or
|
302
|
+
stores error messages.</p>
|
303
|
+
|
304
|
+
|
305
|
+
</div>
|
306
|
+
</div>
|
307
|
+
<div class="tags">
|
308
|
+
<p class="tag_title">Parameters:</p>
|
309
|
+
<ul class="param">
|
310
|
+
|
311
|
+
<li>
|
312
|
+
|
313
|
+
<span class='name'>use</span>
|
314
|
+
|
315
|
+
|
316
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
317
|
+
|
318
|
+
|
319
|
+
<em class="default">(defaults to: <tt>true</tt>)</em>
|
320
|
+
|
321
|
+
|
322
|
+
—
|
323
|
+
<div class='inline'>
|
324
|
+
<p>TRUE if you want to use exceptions, FALSE else.</p>
|
325
|
+
</div>
|
326
|
+
|
327
|
+
</li>
|
328
|
+
|
329
|
+
</ul>
|
330
|
+
|
331
|
+
|
332
|
+
</div><table class="source_code">
|
333
|
+
<tr>
|
334
|
+
<td>
|
335
|
+
<pre class="lines">
|
336
|
+
|
337
|
+
|
338
|
+
11
|
339
|
+
12
|
340
|
+
13</pre>
|
341
|
+
</td>
|
342
|
+
<td>
|
343
|
+
<pre class="code"><span class="info file"># File 'lib/kharon.rb', line 11</span>
|
344
|
+
|
345
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_use_exceptions'>use_exceptions</span><span class='lparen'>(</span><span class='id identifier rubyid_use'>use</span> <span class='op'>=</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
346
|
+
<span class='cvar'>@@use_exceptions</span> <span class='op'>=</span> <span class='id identifier rubyid_use'>use</span>
|
347
|
+
<span class='kw'>end</span></pre>
|
348
|
+
</td>
|
349
|
+
</tr>
|
350
|
+
</table>
|
351
|
+
</div>
|
352
|
+
|
353
|
+
</div>
|
354
|
+
|
355
|
+
</div>
|
356
|
+
|
357
|
+
<div id="footer">
|
358
|
+
Generated on Tue Sep 15 10:54:07 2015 by
|
359
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
360
|
+
0.8.7.6 (ruby-1.9.3).
|
361
|
+
</div>
|
362
|
+
|
363
|
+
</body>
|
364
|
+
</html>
|