schemacop 2.3.0 → 2.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +41 -0
- data/LICENSE +1 -1
- data/README.md +204 -14
- data/RUBY_VERSION +1 -1
- data/Rakefile +6 -5
- data/VERSION +1 -1
- data/doc/Schemacop.html +32 -5
- data/doc/Schemacop/ArrayValidator.html +4 -4
- data/doc/Schemacop/BooleanValidator.html +4 -4
- data/doc/Schemacop/Caster.html +379 -0
- data/doc/Schemacop/Collector.html +180 -104
- data/doc/Schemacop/Exceptions.html +3 -3
- data/doc/Schemacop/Exceptions/InvalidSchemaError.html +3 -3
- data/doc/Schemacop/Exceptions/ValidationError.html +3 -3
- data/doc/Schemacop/FieldNode.html +19 -7
- data/doc/Schemacop/FloatValidator.html +4 -4
- data/doc/Schemacop/HashValidator.html +4 -4
- data/doc/Schemacop/IntegerValidator.html +4 -4
- data/doc/Schemacop/NilValidator.html +4 -4
- data/doc/Schemacop/Node.html +97 -85
- data/doc/Schemacop/NodeResolver.html +28 -12
- data/doc/Schemacop/NodeSupportingField.html +4 -4
- data/doc/Schemacop/NodeSupportingType.html +5 -7
- data/doc/Schemacop/NodeWithBlock.html +4 -4
- data/doc/Schemacop/NumberValidator.html +4 -4
- data/doc/Schemacop/ObjectValidator.html +3 -3
- data/doc/Schemacop/RootNode.html +4 -4
- data/doc/Schemacop/Schema.html +5 -5
- data/doc/Schemacop/StringValidator.html +3 -3
- data/doc/Schemacop/SymbolValidator.html +4 -4
- data/doc/ScopedEnv.html +3 -3
- data/doc/_index.html +11 -4
- data/doc/class_list.html +1 -1
- data/doc/css/style.css +10 -6
- data/doc/file.README.html +198 -16
- data/doc/frames.html +1 -1
- data/doc/index.html +198 -16
- data/doc/js/app.js +55 -0
- data/doc/method_list.html +81 -49
- data/doc/top-level-namespace.html +3 -3
- data/lib/schemacop.rb +14 -0
- data/lib/schemacop/caster.rb +38 -0
- data/lib/schemacop/collector.rb +34 -6
- data/lib/schemacop/field_node.rb +24 -3
- data/lib/schemacop/node.rb +16 -4
- data/lib/schemacop/node_resolver.rb +10 -2
- data/lib/schemacop/node_supporting_type.rb +19 -1
- data/lib/schemacop/schema.rb +2 -2
- data/lib/schemacop/validator/array_validator.rb +1 -1
- data/lib/schemacop/validator/float_validator.rb +1 -1
- data/lib/schemacop/validator/integer_validator.rb +1 -1
- data/lib/schemacop/validator/object_validator.rb +1 -1
- data/schemacop.gemspec +15 -9
- data/test/casting_test.rb +90 -0
- data/test/custom_check_test.rb +20 -13
- data/test/custom_if_test.rb +12 -12
- data/test/defaults_test.rb +71 -0
- data/test/nil_dis_allow_test.rb +6 -6
- data/test/node_resolver_test.rb +26 -0
- data/test/short_forms_test.rb +84 -66
- data/test/test_helper.rb +7 -0
- data/test/types_test.rb +5 -5
- data/test/validator_array_test.rb +16 -16
- data/test/validator_boolean_test.rb +2 -2
- data/test/validator_float_test.rb +15 -15
- data/test/validator_hash_test.rb +5 -5
- data/test/validator_integer_test.rb +9 -9
- data/test/validator_nil_test.rb +1 -1
- data/test/validator_number_test.rb +19 -19
- data/test/validator_object_test.rb +52 -18
- data/test/validator_string_test.rb +12 -12
- data/test/validator_symbol_test.rb +2 -2
- metadata +43 -14
data/doc/js/app.js
CHANGED
@@ -120,6 +120,49 @@ function summaryToggle() {
|
|
120
120
|
} else { localStorage.summaryCollapsed = "expand"; }
|
121
121
|
}
|
122
122
|
|
123
|
+
function constantSummaryToggle() {
|
124
|
+
$('.constants_summary_toggle').click(function(e) {
|
125
|
+
e.preventDefault();
|
126
|
+
localStorage.summaryCollapsed = $(this).text();
|
127
|
+
$('.constants_summary_toggle').each(function() {
|
128
|
+
$(this).text($(this).text() == "collapse" ? "expand" : "collapse");
|
129
|
+
var next = $(this).parent().parent().nextAll('dl.constants').first();
|
130
|
+
if (next.hasClass('compact')) {
|
131
|
+
next.toggle();
|
132
|
+
next.nextAll('dl.constants').first().toggle();
|
133
|
+
}
|
134
|
+
else if (next.hasClass('constants')) {
|
135
|
+
var list = $('<dl class="constants compact" />');
|
136
|
+
list.html(next.html());
|
137
|
+
list.find('dt').each(function() {
|
138
|
+
$(this).addClass('summary_signature');
|
139
|
+
$(this).text( $(this).text().split('=')[0]);
|
140
|
+
if ($(this).has(".deprecated").length) {
|
141
|
+
$(this).addClass('deprecated');
|
142
|
+
};
|
143
|
+
});
|
144
|
+
// Add the value of the constant as "Tooltip" to the summary object
|
145
|
+
list.find('pre.code').each(function() {
|
146
|
+
console.log($(this).parent());
|
147
|
+
var dt_element = $(this).parent().prev();
|
148
|
+
var tooltip = $(this).text();
|
149
|
+
if (dt_element.hasClass("deprecated")) {
|
150
|
+
tooltip = 'Deprecated. ' + tooltip;
|
151
|
+
};
|
152
|
+
dt_element.attr('title', tooltip);
|
153
|
+
});
|
154
|
+
list.find('.docstring, .tags, dd').remove();
|
155
|
+
next.before(list);
|
156
|
+
next.toggle();
|
157
|
+
}
|
158
|
+
});
|
159
|
+
return false;
|
160
|
+
});
|
161
|
+
if (localStorage.summaryCollapsed == "collapse") {
|
162
|
+
$('.constants_summary_toggle').first().click();
|
163
|
+
} else { localStorage.summaryCollapsed = "expand"; }
|
164
|
+
}
|
165
|
+
|
123
166
|
function generateTOC() {
|
124
167
|
if ($('#filecontents').length === 0) return;
|
125
168
|
var _toc = $('<ol class="top"></ol>');
|
@@ -232,6 +275,16 @@ function mainFocus() {
|
|
232
275
|
setTimeout(function() { $('#main').focus(); }, 10);
|
233
276
|
}
|
234
277
|
|
278
|
+
function navigationChange() {
|
279
|
+
// This works around the broken anchor navigation with the YARD template.
|
280
|
+
window.onpopstate = function() {
|
281
|
+
var hash = window.location.hash;
|
282
|
+
if (hash !== '' && $(hash)[0]) {
|
283
|
+
$(hash)[0].scrollIntoView();
|
284
|
+
}
|
285
|
+
};
|
286
|
+
}
|
287
|
+
|
235
288
|
$(document).ready(function() {
|
236
289
|
navResizer();
|
237
290
|
navExpander();
|
@@ -241,8 +294,10 @@ $(document).ready(function() {
|
|
241
294
|
searchFrameButtons();
|
242
295
|
linkSummaries();
|
243
296
|
summaryToggle();
|
297
|
+
constantSummaryToggle();
|
244
298
|
generateTOC();
|
245
299
|
mainFocus();
|
300
|
+
navigationChange();
|
246
301
|
});
|
247
302
|
|
248
303
|
})();
|
data/doc/method_list.html
CHANGED
@@ -68,6 +68,22 @@
|
|
68
68
|
</li>
|
69
69
|
|
70
70
|
|
71
|
+
<li class="even ">
|
72
|
+
<div class="item">
|
73
|
+
<span class='object_link'><a href="Schemacop/Caster.html#cast-instance_method" title="Schemacop::Caster#cast (method)">#cast</a></span>
|
74
|
+
<small>Schemacop::Caster</small>
|
75
|
+
</div>
|
76
|
+
</li>
|
77
|
+
|
78
|
+
|
79
|
+
<li class="odd ">
|
80
|
+
<div class="item">
|
81
|
+
<span class='object_link'><a href="Schemacop/Caster.html#castable%3F-instance_method" title="Schemacop::Caster#castable? (method)">#castable?</a></span>
|
82
|
+
<small>Schemacop::Caster</small>
|
83
|
+
</div>
|
84
|
+
</li>
|
85
|
+
|
86
|
+
|
71
87
|
<li class="even ">
|
72
88
|
<div class="item">
|
73
89
|
<span class='object_link'><a href="Schemacop/Node.html#class_matches%3F-class_method" title="Schemacop::Node.class_matches? (method)">class_matches?</a></span>
|
@@ -94,7 +110,7 @@
|
|
94
110
|
|
95
111
|
<li class="odd ">
|
96
112
|
<div class="item">
|
97
|
-
<span class='object_link'><a href="Schemacop/Collector.html#
|
113
|
+
<span class='object_link'><a href="Schemacop/Collector.html#data-instance_method" title="Schemacop::Collector#data (method)">#data</a></span>
|
98
114
|
<small>Schemacop::Collector</small>
|
99
115
|
</div>
|
100
116
|
</li>
|
@@ -126,8 +142,8 @@
|
|
126
142
|
|
127
143
|
<li class="odd ">
|
128
144
|
<div class="item">
|
129
|
-
<span class='object_link'><a href="Schemacop/
|
130
|
-
<small>Schemacop::
|
145
|
+
<span class='object_link'><a href="Schemacop/NodeSupportingType.html#exec_block-instance_method" title="Schemacop::NodeSupportingType#exec_block (method)">#exec_block</a></span>
|
146
|
+
<small>Schemacop::NodeSupportingType</small>
|
131
147
|
</div>
|
132
148
|
</li>
|
133
149
|
|
@@ -142,8 +158,8 @@
|
|
142
158
|
|
143
159
|
<li class="odd ">
|
144
160
|
<div class="item">
|
145
|
-
<span class='object_link'><a href="Schemacop/
|
146
|
-
<small>Schemacop::
|
161
|
+
<span class='object_link'><a href="Schemacop/Node.html#exec_block-instance_method" title="Schemacop::Node#exec_block (method)">#exec_block</a></span>
|
162
|
+
<small>Schemacop::Node</small>
|
147
163
|
</div>
|
148
164
|
</li>
|
149
165
|
|
@@ -166,48 +182,48 @@
|
|
166
182
|
|
167
183
|
<li class="even ">
|
168
184
|
<div class="item">
|
169
|
-
<span class='object_link'><a href="Schemacop/
|
170
|
-
<small>Schemacop::
|
185
|
+
<span class='object_link'><a href="Schemacop/Schema.html#initialize-instance_method" title="Schemacop::Schema#initialize (method)">#initialize</a></span>
|
186
|
+
<small>Schemacop::Schema</small>
|
171
187
|
</div>
|
172
188
|
</li>
|
173
189
|
|
174
190
|
|
175
191
|
<li class="odd ">
|
176
192
|
<div class="item">
|
177
|
-
<span class='object_link'><a href="Schemacop/
|
178
|
-
<small>Schemacop::
|
193
|
+
<span class='object_link'><a href="Schemacop/NodeSupportingType.html#initialize-instance_method" title="Schemacop::NodeSupportingType#initialize (method)">#initialize</a></span>
|
194
|
+
<small>Schemacop::NodeSupportingType</small>
|
179
195
|
</div>
|
180
196
|
</li>
|
181
197
|
|
182
198
|
|
183
199
|
<li class="even ">
|
184
200
|
<div class="item">
|
185
|
-
<span class='object_link'><a href="Schemacop/
|
186
|
-
<small>Schemacop::
|
201
|
+
<span class='object_link'><a href="Schemacop/Node.html#initialize-instance_method" title="Schemacop::Node#initialize (method)">#initialize</a></span>
|
202
|
+
<small>Schemacop::Node</small>
|
187
203
|
</div>
|
188
204
|
</li>
|
189
205
|
|
190
206
|
|
191
207
|
<li class="odd ">
|
192
208
|
<div class="item">
|
193
|
-
<span class='object_link'><a href="
|
194
|
-
<small>
|
209
|
+
<span class='object_link'><a href="ScopedEnv.html#initialize-instance_method" title="ScopedEnv#initialize (method)">#initialize</a></span>
|
210
|
+
<small>ScopedEnv</small>
|
195
211
|
</div>
|
196
212
|
</li>
|
197
213
|
|
198
214
|
|
199
215
|
<li class="even ">
|
200
216
|
<div class="item">
|
201
|
-
<span class='object_link'><a href="
|
202
|
-
<small>
|
217
|
+
<span class='object_link'><a href="Schemacop/FieldNode.html#initialize-instance_method" title="Schemacop::FieldNode#initialize (method)">#initialize</a></span>
|
218
|
+
<small>Schemacop::FieldNode</small>
|
203
219
|
</div>
|
204
220
|
</li>
|
205
221
|
|
206
222
|
|
207
223
|
<li class="odd ">
|
208
224
|
<div class="item">
|
209
|
-
<span class='object_link'><a href="Schemacop/
|
210
|
-
<small>Schemacop::
|
225
|
+
<span class='object_link'><a href="Schemacop/Caster.html#initialize-instance_method" title="Schemacop::Caster#initialize (method)">#initialize</a></span>
|
226
|
+
<small>Schemacop::Caster</small>
|
211
227
|
</div>
|
212
228
|
</li>
|
213
229
|
|
@@ -229,6 +245,14 @@
|
|
229
245
|
|
230
246
|
|
231
247
|
<li class="even ">
|
248
|
+
<div class="item">
|
249
|
+
<span class='object_link'><a href="Schemacop/Collector.html#initialize-instance_method" title="Schemacop::Collector#initialize (method)">#initialize</a></span>
|
250
|
+
<small>Schemacop::Collector</small>
|
251
|
+
</div>
|
252
|
+
</li>
|
253
|
+
|
254
|
+
|
255
|
+
<li class="odd ">
|
232
256
|
<div class="item">
|
233
257
|
<span class='object_link'><a href="Schemacop/StringValidator.html#initialize-instance_method" title="Schemacop::StringValidator#initialize (method)">#initialize</a></span>
|
234
258
|
<small>Schemacop::StringValidator</small>
|
@@ -236,7 +260,7 @@
|
|
236
260
|
</li>
|
237
261
|
|
238
262
|
|
239
|
-
<li class="
|
263
|
+
<li class="even ">
|
240
264
|
<div class="item">
|
241
265
|
<span class='object_link'><a href="Schemacop/Schema.html#invalid%3F-instance_method" title="Schemacop::Schema#invalid? (method)">#invalid?</a></span>
|
242
266
|
<small>Schemacop::Schema</small>
|
@@ -244,7 +268,7 @@
|
|
244
268
|
</li>
|
245
269
|
|
246
270
|
|
247
|
-
<li class="
|
271
|
+
<li class="odd ">
|
248
272
|
<div class="item">
|
249
273
|
<span class='object_link'><a href="Schemacop/Node.html#klass-class_method" title="Schemacop::Node.klass (method)">klass</a></span>
|
250
274
|
<small>Schemacop::Node</small>
|
@@ -252,7 +276,7 @@
|
|
252
276
|
</li>
|
253
277
|
|
254
278
|
|
255
|
-
<li class="
|
279
|
+
<li class="even ">
|
256
280
|
<div class="item">
|
257
281
|
<span class='object_link'><a href="ScopedEnv.html#method_missing-instance_method" title="ScopedEnv#method_missing (method)">#method_missing</a></span>
|
258
282
|
<small>ScopedEnv</small>
|
@@ -260,7 +284,7 @@
|
|
260
284
|
</li>
|
261
285
|
|
262
286
|
|
263
|
-
<li class="
|
287
|
+
<li class="odd ">
|
264
288
|
<div class="item">
|
265
289
|
<span class='object_link'><a href="Schemacop/FieldNode.html#name-instance_method" title="Schemacop::FieldNode#name (method)">#name</a></span>
|
266
290
|
<small>Schemacop::FieldNode</small>
|
@@ -268,7 +292,7 @@
|
|
268
292
|
</li>
|
269
293
|
|
270
294
|
|
271
|
-
<li class="
|
295
|
+
<li class="even ">
|
272
296
|
<div class="item">
|
273
297
|
<span class='object_link'><a href="Schemacop/NodeSupportingField.html#opt!-instance_method" title="Schemacop::NodeSupportingField#opt! (method)">#opt!</a></span>
|
274
298
|
<small>Schemacop::NodeSupportingField</small>
|
@@ -276,7 +300,7 @@
|
|
276
300
|
</li>
|
277
301
|
|
278
302
|
|
279
|
-
<li class="
|
303
|
+
<li class="odd ">
|
280
304
|
<div class="item">
|
281
305
|
<span class='object_link'><a href="Schemacop/NodeSupportingField.html#opt%3F-instance_method" title="Schemacop::NodeSupportingField#opt? (method)">#opt?</a></span>
|
282
306
|
<small>Schemacop::NodeSupportingField</small>
|
@@ -284,7 +308,7 @@
|
|
284
308
|
</li>
|
285
309
|
|
286
310
|
|
287
|
-
<li class="
|
311
|
+
<li class="even ">
|
288
312
|
<div class="item">
|
289
313
|
<span class='object_link'><a href="Schemacop/Node.html#option-class_method" title="Schemacop::Node.option (method)">option</a></span>
|
290
314
|
<small>Schemacop::Node</small>
|
@@ -292,7 +316,7 @@
|
|
292
316
|
</li>
|
293
317
|
|
294
318
|
|
295
|
-
<li class="
|
319
|
+
<li class="odd ">
|
296
320
|
<div class="item">
|
297
321
|
<span class='object_link'><a href="Schemacop/Node.html#option-instance_method" title="Schemacop::Node#option (method)">#option</a></span>
|
298
322
|
<small>Schemacop::Node</small>
|
@@ -300,7 +324,7 @@
|
|
300
324
|
</li>
|
301
325
|
|
302
326
|
|
303
|
-
<li class="
|
327
|
+
<li class="even ">
|
304
328
|
<div class="item">
|
305
329
|
<span class='object_link'><a href="Schemacop/Node.html#option%3F-instance_method" title="Schemacop::Node#option? (method)">#option?</a></span>
|
306
330
|
<small>Schemacop::Node</small>
|
@@ -308,7 +332,7 @@
|
|
308
332
|
</li>
|
309
333
|
|
310
334
|
|
311
|
-
<li class="
|
335
|
+
<li class="odd ">
|
312
336
|
<div class="item">
|
313
337
|
<span class='object_link'><a href="Schemacop/Node.html#options-instance_method" title="Schemacop::Node#options (method)">#options</a></span>
|
314
338
|
<small>Schemacop::Node</small>
|
@@ -316,6 +340,14 @@
|
|
316
340
|
</li>
|
317
341
|
|
318
342
|
|
343
|
+
<li class="even ">
|
344
|
+
<div class="item">
|
345
|
+
<span class='object_link'><a href="Schemacop/Collector.html#override_value-instance_method" title="Schemacop::Collector#override_value (method)">#override_value</a></span>
|
346
|
+
<small>Schemacop::Collector</small>
|
347
|
+
</div>
|
348
|
+
</li>
|
349
|
+
|
350
|
+
|
319
351
|
<li class="odd ">
|
320
352
|
<div class="item">
|
321
353
|
<span class='object_link'><a href="Schemacop/Collector.html#path-instance_method" title="Schemacop::Collector#path (method)">#path</a></span>
|
@@ -326,16 +358,16 @@
|
|
326
358
|
|
327
359
|
<li class="even ">
|
328
360
|
<div class="item">
|
329
|
-
<span class='object_link'><a href="Schemacop/
|
330
|
-
<small>Schemacop::
|
361
|
+
<span class='object_link'><a href="Schemacop/NodeResolver.html#register-class_method" title="Schemacop::NodeResolver.register (method)">register</a></span>
|
362
|
+
<small>Schemacop::NodeResolver</small>
|
331
363
|
</div>
|
332
364
|
</li>
|
333
365
|
|
334
366
|
|
335
367
|
<li class="odd ">
|
336
368
|
<div class="item">
|
337
|
-
<span class='object_link'><a href="Schemacop/
|
338
|
-
<small>Schemacop::
|
369
|
+
<span class='object_link'><a href="Schemacop/Node.html#register-class_method" title="Schemacop::Node.register (method)">register</a></span>
|
370
|
+
<small>Schemacop::Node</small>
|
339
371
|
</div>
|
340
372
|
</li>
|
341
373
|
|
@@ -454,24 +486,24 @@
|
|
454
486
|
|
455
487
|
<li class="even ">
|
456
488
|
<div class="item">
|
457
|
-
<span class='object_link'><a href="Schemacop/
|
458
|
-
<small>Schemacop::
|
489
|
+
<span class='object_link'><a href="Schemacop/Collector.html#valid%3F-instance_method" title="Schemacop::Collector#valid? (method)">#valid?</a></span>
|
490
|
+
<small>Schemacop::Collector</small>
|
459
491
|
</div>
|
460
492
|
</li>
|
461
493
|
|
462
494
|
|
463
495
|
<li class="odd ">
|
464
496
|
<div class="item">
|
465
|
-
<span class='object_link'><a href="Schemacop/
|
466
|
-
<small>Schemacop::
|
497
|
+
<span class='object_link'><a href="Schemacop/Schema.html#valid%3F-instance_method" title="Schemacop::Schema#valid? (method)">#valid?</a></span>
|
498
|
+
<small>Schemacop::Schema</small>
|
467
499
|
</div>
|
468
500
|
</li>
|
469
501
|
|
470
502
|
|
471
503
|
<li class="even ">
|
472
504
|
<div class="item">
|
473
|
-
<span class='object_link'><a href="Schemacop/
|
474
|
-
<small>Schemacop::
|
505
|
+
<span class='object_link'><a href="Schemacop/HashValidator.html#validate-instance_method" title="Schemacop::HashValidator#validate (method)">#validate</a></span>
|
506
|
+
<small>Schemacop::HashValidator</small>
|
475
507
|
</div>
|
476
508
|
</li>
|
477
509
|
|
@@ -486,48 +518,48 @@
|
|
486
518
|
|
487
519
|
<li class="even ">
|
488
520
|
<div class="item">
|
489
|
-
<span class='object_link'><a href="Schemacop/
|
490
|
-
<small>Schemacop::
|
521
|
+
<span class='object_link'><a href="Schemacop/ArrayValidator.html#validate-instance_method" title="Schemacop::ArrayValidator#validate (method)">#validate</a></span>
|
522
|
+
<small>Schemacop::ArrayValidator</small>
|
491
523
|
</div>
|
492
524
|
</li>
|
493
525
|
|
494
526
|
|
495
527
|
<li class="odd ">
|
496
528
|
<div class="item">
|
497
|
-
<span class='object_link'><a href="Schemacop/
|
498
|
-
<small>Schemacop::
|
529
|
+
<span class='object_link'><a href="Schemacop/NumberValidator.html#validate-instance_method" title="Schemacop::NumberValidator#validate (method)">#validate</a></span>
|
530
|
+
<small>Schemacop::NumberValidator</small>
|
499
531
|
</div>
|
500
532
|
</li>
|
501
533
|
|
502
534
|
|
503
535
|
<li class="even ">
|
504
536
|
<div class="item">
|
505
|
-
<span class='object_link'><a href="Schemacop/
|
506
|
-
<small>Schemacop::
|
537
|
+
<span class='object_link'><a href="Schemacop/StringValidator.html#validate-instance_method" title="Schemacop::StringValidator#validate (method)">#validate</a></span>
|
538
|
+
<small>Schemacop::StringValidator</small>
|
507
539
|
</div>
|
508
540
|
</li>
|
509
541
|
|
510
542
|
|
511
543
|
<li class="odd ">
|
512
544
|
<div class="item">
|
513
|
-
<span class='object_link'><a href="Schemacop/
|
514
|
-
<small>Schemacop::
|
545
|
+
<span class='object_link'><a href="Schemacop/NodeSupportingType.html#validate-instance_method" title="Schemacop::NodeSupportingType#validate (method)">#validate</a></span>
|
546
|
+
<small>Schemacop::NodeSupportingType</small>
|
515
547
|
</div>
|
516
548
|
</li>
|
517
549
|
|
518
550
|
|
519
551
|
<li class="even ">
|
520
552
|
<div class="item">
|
521
|
-
<span class='object_link'><a href="Schemacop/
|
522
|
-
<small>Schemacop::
|
553
|
+
<span class='object_link'><a href="Schemacop/FieldNode.html#validate-instance_method" title="Schemacop::FieldNode#validate (method)">#validate</a></span>
|
554
|
+
<small>Schemacop::FieldNode</small>
|
523
555
|
</div>
|
524
556
|
</li>
|
525
557
|
|
526
558
|
|
527
559
|
<li class="odd ">
|
528
560
|
<div class="item">
|
529
|
-
<span class='object_link'><a href="Schemacop/
|
530
|
-
<small>Schemacop::
|
561
|
+
<span class='object_link'><a href="Schemacop/Node.html#validate-instance_method" title="Schemacop::Node#validate (method)">#validate</a></span>
|
562
|
+
<small>Schemacop::Node</small>
|
531
563
|
</div>
|
532
564
|
</li>
|
533
565
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Top Level Namespace
|
8
8
|
|
9
|
-
— Documentation by YARD 0.9.
|
9
|
+
— Documentation by YARD 0.9.20
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -102,9 +102,9 @@
|
|
102
102
|
</div>
|
103
103
|
|
104
104
|
<div id="footer">
|
105
|
-
Generated on
|
105
|
+
Generated on Tue Nov 5 11:16:27 2019 by
|
106
106
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
107
|
-
0.9.
|
107
|
+
0.9.20 (ruby-2.6.2).
|
108
108
|
</div>
|
109
109
|
|
110
110
|
</div>
|
data/lib/schemacop.rb
CHANGED
@@ -1,9 +1,22 @@
|
|
1
1
|
module Schemacop
|
2
|
+
DEFAULT_CASTERS = {
|
3
|
+
String => {
|
4
|
+
Integer => proc { |s| Integer(s) },
|
5
|
+
Float => proc { |s| Float(s) }
|
6
|
+
},
|
7
|
+
Float => {
|
8
|
+
Integer => proc { |f| Integer(f) }
|
9
|
+
},
|
10
|
+
Integer => {
|
11
|
+
Float => proc { |f| Float(f) }
|
12
|
+
}
|
13
|
+
}
|
2
14
|
end
|
3
15
|
|
4
16
|
require 'set'
|
5
17
|
require 'active_support/core_ext/class/attribute'
|
6
18
|
require 'active_support/hash_with_indifferent_access'
|
19
|
+
require 'active_support/core_ext/object/deep_dup'
|
7
20
|
|
8
21
|
require 'schemacop/scoped_env'
|
9
22
|
require 'schemacop/exceptions'
|
@@ -16,6 +29,7 @@ require 'schemacop/node_supporting_type'
|
|
16
29
|
require 'schemacop/field_node'
|
17
30
|
require 'schemacop/root_node'
|
18
31
|
require 'schemacop/node_supporting_field'
|
32
|
+
require 'schemacop/caster'
|
19
33
|
require 'schemacop/validator/array_validator'
|
20
34
|
require 'schemacop/validator/boolean_validator'
|
21
35
|
require 'schemacop/validator/hash_validator'
|