schemacop 2.4.2 → 2.4.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -0
- data/LICENSE +1 -1
- data/README.md +18 -2
- data/VERSION +1 -1
- data/doc/Schemacop.html +5 -5
- data/doc/Schemacop/ArrayValidator.html +1 -1
- data/doc/Schemacop/BooleanValidator.html +1 -1
- data/doc/Schemacop/Caster.html +1 -1
- data/doc/Schemacop/Collector.html +1 -1
- data/doc/Schemacop/Dupper.html +214 -0
- data/doc/Schemacop/Exceptions.html +1 -1
- data/doc/Schemacop/Exceptions/InvalidSchemaError.html +1 -1
- data/doc/Schemacop/Exceptions/ValidationError.html +1 -1
- data/doc/Schemacop/FieldNode.html +1 -1
- data/doc/Schemacop/FloatValidator.html +1 -1
- data/doc/Schemacop/HashValidator.html +10 -6
- data/doc/Schemacop/IntegerValidator.html +1 -1
- data/doc/Schemacop/NilValidator.html +1 -1
- data/doc/Schemacop/Node.html +1 -1
- data/doc/Schemacop/NodeResolver.html +1 -1
- data/doc/Schemacop/NodeSupportingField.html +1 -1
- data/doc/Schemacop/NodeSupportingType.html +1 -1
- data/doc/Schemacop/NodeWithBlock.html +1 -1
- data/doc/Schemacop/NumberValidator.html +1 -1
- data/doc/Schemacop/ObjectValidator.html +1 -1
- data/doc/Schemacop/RootNode.html +1 -1
- data/doc/Schemacop/Schema.html +8 -6
- data/doc/Schemacop/StringValidator.html +1 -1
- data/doc/Schemacop/SymbolValidator.html +1 -1
- data/doc/ScopedEnv.html +1 -1
- data/doc/_index.html +19 -4
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +19 -4
- data/doc/index.html +19 -4
- data/doc/method_list.html +93 -85
- data/doc/top-level-namespace.html +1 -1
- data/lib/schemacop.rb +4 -3
- data/lib/schemacop/dupper.rb +19 -0
- data/lib/schemacop/field_node.rb +1 -0
- data/lib/schemacop/node_supporting_type.rb +6 -6
- data/lib/schemacop/schema.rb +2 -1
- data/lib/schemacop/validator/hash_validator.rb +5 -1
- data/schemacop.gemspec +5 -5
- data/test/casting_test.rb +28 -0
- data/test/defaults_test.rb +22 -0
- data/test/empty_test.rb +14 -0
- data/test/validator_hash_test.rb +22 -0
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b84cfd3771e9bf279d88c3c13d79432951bcd37f19db4f4ea9e275b45b4f70d5
|
4
|
+
data.tar.gz: 7aef2cd86d1c4e42b0242137d721d5b9ab0f808083436fcee15fdf72e252336d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bffa5cdc99b8d6e5aa478b182f87041aa9cf4616d62459fa386829a154c6fd2fde2c75d4c8504741e26eac6ab3478cad811fa33b363580bed7b5c1f04ff4ad6
|
7
|
+
data.tar.gz: 7bb43ad27b2966851c30803a96b0b733b7ba9062784edd08fbb94aadc52c5c61e1142455bab0ad7d8a46c2c8e21572d26e3625f649ece2d18d468c2ea94b495b
|
data/CHANGELOG.md
CHANGED
@@ -10,6 +10,29 @@
|
|
10
10
|
### Changes
|
11
11
|
-->
|
12
12
|
|
13
|
+
## 2.4.7 (2020-07-02)
|
14
|
+
|
15
|
+
* Return nil when casting an empty string to an Integer or a Float,
|
16
|
+
such that these cases can then be handled by the `opt` or `req`.
|
17
|
+
|
18
|
+
## 2.4.6 (2020-06-29)
|
19
|
+
|
20
|
+
* Use basis 10 (decimal system) when casting a `String` to an `Integer`
|
21
|
+
|
22
|
+
## 2.4.5 (2020-05-13)
|
23
|
+
|
24
|
+
* Allow procs for `default` that will be evaluated at runtime
|
25
|
+
|
26
|
+
## 2.4.4 (2020-03-9)
|
27
|
+
|
28
|
+
* Add option `allow_obsolete_keys` to `:hash` validator in order to allow
|
29
|
+
validating arbitrary hashes with dynamic keys not specifiable in schema.
|
30
|
+
|
31
|
+
## 2.4.3 (2020-03-05)
|
32
|
+
|
33
|
+
* Only dup hashes and arrays but not the values when creating the modified
|
34
|
+
datastructure that is returned by `validate!`.
|
35
|
+
|
13
36
|
## 2.4.2 (2019-11-05)
|
14
37
|
|
15
38
|
### Bug fixes
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -395,6 +395,10 @@ The following types are supported by Schemacop by default:
|
|
395
395
|
|
396
396
|
- accepts a block with an arbitrary number of Field Lines.
|
397
397
|
|
398
|
+
- `allow_obsolete_keys`: If enabled (default `false`), this allows arbitrary
|
399
|
+
keys within your hash. Keys not specified in your schema will not be
|
400
|
+
validated further, but keys specified explicitly are still validated.
|
401
|
+
|
398
402
|
* `:nil`: accepts a Ruby NilClass instance. If you want to allow `nil` as a
|
399
403
|
value in a field, see above for the usage of the suffixes `-!` and `-?` for
|
400
404
|
Field Lines.
|
@@ -623,6 +627,18 @@ Schema.new do
|
|
623
627
|
req :foo
|
624
628
|
end
|
625
629
|
end
|
630
|
+
|
631
|
+
# You can also specify blocks (without params) as defaults that will be
|
632
|
+
# evaluated at time of validation.
|
633
|
+
Schema.new do
|
634
|
+
opt :year, :integer, default: ->() { Time.now.year }
|
635
|
+
end
|
636
|
+
|
637
|
+
# If, for some very specific reason, you *need* the default to be an actual
|
638
|
+
# proc, wrap it inside another proc.
|
639
|
+
Schema.new do
|
640
|
+
opt :myproc, Proc, default: ->() { ->() { 42 } }
|
641
|
+
end
|
626
642
|
```
|
627
643
|
|
628
644
|
### Required data points
|
@@ -668,7 +684,7 @@ Example:
|
|
668
684
|
Schema.new do
|
669
685
|
# Pass array to `cast`. This enables casting from String or Float to Integer
|
670
686
|
# using the built-in casters.
|
671
|
-
req:
|
687
|
+
req :id_1, :integer, cast: [String, Float]
|
672
688
|
|
673
689
|
# Pass hash to `cast`. This enables casting from Float to Integer using the
|
674
690
|
# built-in caster and from String to Integer using a custom callback.
|
@@ -759,4 +775,4 @@ To run tests:
|
|
759
775
|
|
760
776
|
## Copyright
|
761
777
|
|
762
|
-
Copyright (c)
|
778
|
+
Copyright (c) 2020 Sitrox. See `LICENSE` for further details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.4.
|
1
|
+
2.4.7
|
data/doc/Schemacop.html
CHANGED
@@ -79,7 +79,7 @@
|
|
79
79
|
<dl>
|
80
80
|
<dt>Defined in:</dt>
|
81
81
|
<dd>lib/schemacop.rb<span class="defines">,<br />
|
82
|
-
lib/schemacop/node.rb,<br /> lib/schemacop/caster.rb,<br /> lib/schemacop/schema.rb,<br /> lib/schemacop/collector.rb,<br /> lib/schemacop/root_node.rb,<br /> lib/schemacop/field_node.rb,<br /> lib/schemacop/node_resolver.rb,<br /> lib/schemacop/node_with_block.rb,<br /> lib/schemacop/node_supporting_type.rb,<br /> lib/schemacop/node_supporting_field.rb,<br /> lib/schemacop/validator/nil_validator.rb,<br /> lib/schemacop/validator/hash_validator.rb,<br /> lib/schemacop/validator/array_validator.rb,<br /> lib/schemacop/validator/float_validator.rb,<br /> lib/schemacop/validator/number_validator.rb,<br /> lib/schemacop/validator/object_validator.rb,<br /> lib/schemacop/validator/string_validator.rb,<br /> lib/schemacop/validator/symbol_validator.rb,<br /> lib/schemacop/validator/boolean_validator.rb,<br /> lib/schemacop/validator/integer_validator.rb</span>
|
82
|
+
lib/schemacop/node.rb,<br /> lib/schemacop/caster.rb,<br /> lib/schemacop/dupper.rb,<br /> lib/schemacop/schema.rb,<br /> lib/schemacop/collector.rb,<br /> lib/schemacop/root_node.rb,<br /> lib/schemacop/field_node.rb,<br /> lib/schemacop/node_resolver.rb,<br /> lib/schemacop/node_with_block.rb,<br /> lib/schemacop/node_supporting_type.rb,<br /> lib/schemacop/node_supporting_field.rb,<br /> lib/schemacop/validator/nil_validator.rb,<br /> lib/schemacop/validator/hash_validator.rb,<br /> lib/schemacop/validator/array_validator.rb,<br /> lib/schemacop/validator/float_validator.rb,<br /> lib/schemacop/validator/number_validator.rb,<br /> lib/schemacop/validator/object_validator.rb,<br /> lib/schemacop/validator/string_validator.rb,<br /> lib/schemacop/validator/symbol_validator.rb,<br /> lib/schemacop/validator/boolean_validator.rb,<br /> lib/schemacop/validator/integer_validator.rb</span>
|
83
83
|
</dd>
|
84
84
|
</dl>
|
85
85
|
|
@@ -93,7 +93,7 @@
|
|
93
93
|
|
94
94
|
|
95
95
|
|
96
|
-
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Schemacop/ArrayValidator.html" title="Schemacop::ArrayValidator (class)">ArrayValidator</a></span>, <span class='object_link'><a href="Schemacop/BooleanValidator.html" title="Schemacop::BooleanValidator (class)">BooleanValidator</a></span>, <span class='object_link'><a href="Schemacop/Caster.html" title="Schemacop::Caster (class)">Caster</a></span>, <span class='object_link'><a href="Schemacop/Collector.html" title="Schemacop::Collector (class)">Collector</a></span>, <span class='object_link'><a href="Schemacop/FieldNode.html" title="Schemacop::FieldNode (class)">FieldNode</a></span>, <span class='object_link'><a href="Schemacop/FloatValidator.html" title="Schemacop::FloatValidator (class)">FloatValidator</a></span>, <span class='object_link'><a href="Schemacop/HashValidator.html" title="Schemacop::HashValidator (class)">HashValidator</a></span>, <span class='object_link'><a href="Schemacop/IntegerValidator.html" title="Schemacop::IntegerValidator (class)">IntegerValidator</a></span>, <span class='object_link'><a href="Schemacop/NilValidator.html" title="Schemacop::NilValidator (class)">NilValidator</a></span>, <span class='object_link'><a href="Schemacop/Node.html" title="Schemacop::Node (class)">Node</a></span>, <span class='object_link'><a href="Schemacop/NodeResolver.html" title="Schemacop::NodeResolver (class)">NodeResolver</a></span>, <span class='object_link'><a href="Schemacop/NodeSupportingField.html" title="Schemacop::NodeSupportingField (class)">NodeSupportingField</a></span>, <span class='object_link'><a href="Schemacop/NodeSupportingType.html" title="Schemacop::NodeSupportingType (class)">NodeSupportingType</a></span>, <span class='object_link'><a href="Schemacop/NodeWithBlock.html" title="Schemacop::NodeWithBlock (class)">NodeWithBlock</a></span>, <span class='object_link'><a href="Schemacop/NumberValidator.html" title="Schemacop::NumberValidator (class)">NumberValidator</a></span>, <span class='object_link'><a href="Schemacop/ObjectValidator.html" title="Schemacop::ObjectValidator (class)">ObjectValidator</a></span>, <span class='object_link'><a href="Schemacop/RootNode.html" title="Schemacop::RootNode (class)">RootNode</a></span>, <span class='object_link'><a href="Schemacop/Schema.html" title="Schemacop::Schema (class)">Schema</a></span>, <span class='object_link'><a href="Schemacop/StringValidator.html" title="Schemacop::StringValidator (class)">StringValidator</a></span>, <span class='object_link'><a href="Schemacop/SymbolValidator.html" title="Schemacop::SymbolValidator (class)">SymbolValidator</a></span>
|
96
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Schemacop/ArrayValidator.html" title="Schemacop::ArrayValidator (class)">ArrayValidator</a></span>, <span class='object_link'><a href="Schemacop/BooleanValidator.html" title="Schemacop::BooleanValidator (class)">BooleanValidator</a></span>, <span class='object_link'><a href="Schemacop/Caster.html" title="Schemacop::Caster (class)">Caster</a></span>, <span class='object_link'><a href="Schemacop/Collector.html" title="Schemacop::Collector (class)">Collector</a></span>, <span class='object_link'><a href="Schemacop/Dupper.html" title="Schemacop::Dupper (class)">Dupper</a></span>, <span class='object_link'><a href="Schemacop/FieldNode.html" title="Schemacop::FieldNode (class)">FieldNode</a></span>, <span class='object_link'><a href="Schemacop/FloatValidator.html" title="Schemacop::FloatValidator (class)">FloatValidator</a></span>, <span class='object_link'><a href="Schemacop/HashValidator.html" title="Schemacop::HashValidator (class)">HashValidator</a></span>, <span class='object_link'><a href="Schemacop/IntegerValidator.html" title="Schemacop::IntegerValidator (class)">IntegerValidator</a></span>, <span class='object_link'><a href="Schemacop/NilValidator.html" title="Schemacop::NilValidator (class)">NilValidator</a></span>, <span class='object_link'><a href="Schemacop/Node.html" title="Schemacop::Node (class)">Node</a></span>, <span class='object_link'><a href="Schemacop/NodeResolver.html" title="Schemacop::NodeResolver (class)">NodeResolver</a></span>, <span class='object_link'><a href="Schemacop/NodeSupportingField.html" title="Schemacop::NodeSupportingField (class)">NodeSupportingField</a></span>, <span class='object_link'><a href="Schemacop/NodeSupportingType.html" title="Schemacop::NodeSupportingType (class)">NodeSupportingType</a></span>, <span class='object_link'><a href="Schemacop/NodeWithBlock.html" title="Schemacop::NodeWithBlock (class)">NodeWithBlock</a></span>, <span class='object_link'><a href="Schemacop/NumberValidator.html" title="Schemacop::NumberValidator (class)">NumberValidator</a></span>, <span class='object_link'><a href="Schemacop/ObjectValidator.html" title="Schemacop::ObjectValidator (class)">ObjectValidator</a></span>, <span class='object_link'><a href="Schemacop/RootNode.html" title="Schemacop::RootNode (class)">RootNode</a></span>, <span class='object_link'><a href="Schemacop/Schema.html" title="Schemacop::Schema (class)">Schema</a></span>, <span class='object_link'><a href="Schemacop/StringValidator.html" title="Schemacop::StringValidator (class)">StringValidator</a></span>, <span class='object_link'><a href="Schemacop/SymbolValidator.html" title="Schemacop::SymbolValidator (class)">SymbolValidator</a></span>
|
97
97
|
|
98
98
|
|
99
99
|
</p>
|
@@ -111,8 +111,8 @@
|
|
111
111
|
</dt>
|
112
112
|
<dd><pre class="code"><span class='lbrace'>{</span>
|
113
113
|
<span class='const'>String</span> <span class='op'>=></span> <span class='lbrace'>{</span>
|
114
|
-
<span class='const'>Integer</span> <span class='op'>=></span> <span class='id identifier rubyid_proc'>proc</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_s'>s</span><span class='op'>|</span> <span class='const'>Integer</span><span class='lparen'>(</span><span class='id identifier rubyid_s'>s</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='comma'>,</span>
|
115
|
-
<span class='const'>Float</span> <span class='op'>=></span> <span class='id identifier rubyid_proc'>proc</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_s'>s</span><span class='op'>|</span> <span class='const'>Float</span><span class='lparen'>(</span><span class='id identifier rubyid_s'>s</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
114
|
+
<span class='const'>Integer</span> <span class='op'>=></span> <span class='id identifier rubyid_proc'>proc</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_s'>s</span><span class='op'>|</span> <span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span> <span class='op'>?</span> <span class='kw'>nil</span> <span class='op'>:</span> <span class='const'>Integer</span><span class='lparen'>(</span><span class='id identifier rubyid_s'>s</span><span class='comma'>,</span> <span class='int'>10</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='comma'>,</span>
|
115
|
+
<span class='const'>Float</span> <span class='op'>=></span> <span class='id identifier rubyid_proc'>proc</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_s'>s</span><span class='op'>|</span> <span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span> <span class='op'>?</span> <span class='kw'>nil</span> <span class='op'>:</span> <span class='const'>Float</span><span class='lparen'>(</span><span class='id identifier rubyid_s'>s</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
116
116
|
<span class='rbrace'>}</span><span class='comma'>,</span>
|
117
117
|
<span class='const'>Float</span> <span class='op'>=></span> <span class='lbrace'>{</span>
|
118
118
|
<span class='const'>Integer</span> <span class='op'>=></span> <span class='id identifier rubyid_proc'>proc</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_f'>f</span><span class='op'>|</span> <span class='const'>Integer</span><span class='lparen'>(</span><span class='id identifier rubyid_f'>f</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
@@ -136,7 +136,7 @@
|
|
136
136
|
</div>
|
137
137
|
|
138
138
|
<div id="footer">
|
139
|
-
Generated on
|
139
|
+
Generated on Thu Jul 2 11:30:34 2020 by
|
140
140
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
141
141
|
0.9.20 (ruby-2.6.2).
|
142
142
|
</div>
|
@@ -319,7 +319,7 @@
|
|
319
319
|
</div>
|
320
320
|
|
321
321
|
<div id="footer">
|
322
|
-
Generated on
|
322
|
+
Generated on Thu Jul 2 11:30:34 2020 by
|
323
323
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
324
324
|
0.9.20 (ruby-2.6.2).
|
325
325
|
</div>
|
@@ -135,7 +135,7 @@
|
|
135
135
|
</div>
|
136
136
|
|
137
137
|
<div id="footer">
|
138
|
-
Generated on
|
138
|
+
Generated on Thu Jul 2 11:30:34 2020 by
|
139
139
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
140
140
|
0.9.20 (ruby-2.6.2).
|
141
141
|
</div>
|
data/doc/Schemacop/Caster.html
CHANGED
@@ -369,7 +369,7 @@
|
|
369
369
|
</div>
|
370
370
|
|
371
371
|
<div id="footer">
|
372
|
-
Generated on
|
372
|
+
Generated on Thu Jul 2 11:30:34 2020 by
|
373
373
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
374
374
|
0.9.20 (ruby-2.6.2).
|
375
375
|
</div>
|
@@ -777,7 +777,7 @@ called.
|
|
777
777
|
</div>
|
778
778
|
|
779
779
|
<div id="footer">
|
780
|
-
Generated on
|
780
|
+
Generated on Thu Jul 2 11:30:34 2020 by
|
781
781
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
782
782
|
0.9.20 (ruby-2.6.2).
|
783
783
|
</div>
|
@@ -0,0 +1,214 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Class: Schemacop::Dupper
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.20
|
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
|
+
pathId = "Schemacop::Dupper";
|
19
|
+
relpath = '../';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="../class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="../_index.html">Index (D)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../Schemacop.html" title="Schemacop (module)">Schemacop</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">Dupper</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="../class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Class: Schemacop::Dupper
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName">Object</span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next">Schemacop::Dupper</li>
|
78
|
+
|
79
|
+
</ul>
|
80
|
+
<a href="#" class="inheritanceTree">show all</a>
|
81
|
+
|
82
|
+
</dd>
|
83
|
+
</dl>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
<dl>
|
96
|
+
<dt>Defined in:</dt>
|
97
|
+
<dd>lib/schemacop/dupper.rb</dd>
|
98
|
+
</dl>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
<h2>
|
111
|
+
Class Method Summary
|
112
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
113
|
+
</h2>
|
114
|
+
|
115
|
+
<ul class="summary">
|
116
|
+
|
117
|
+
<li class="public ">
|
118
|
+
<span class="summary_signature">
|
119
|
+
|
120
|
+
<a href="#dup_data-class_method" title="dup_data (class method)">.<strong>dup_data</strong>(data) ⇒ Object </a>
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
</span>
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
135
|
+
|
136
|
+
</li>
|
137
|
+
|
138
|
+
|
139
|
+
</ul>
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
<div id="class_method_details" class="method_details_list">
|
145
|
+
<h2>Class Method Details</h2>
|
146
|
+
|
147
|
+
|
148
|
+
<div class="method_details first">
|
149
|
+
<h3 class="signature first" id="dup_data-class_method">
|
150
|
+
|
151
|
+
.<strong>dup_data</strong>(data) ⇒ <tt>Object</tt>
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
</h3><table class="source_code">
|
158
|
+
<tr>
|
159
|
+
<td>
|
160
|
+
<pre class="lines">
|
161
|
+
|
162
|
+
|
163
|
+
3
|
164
|
+
4
|
165
|
+
5
|
166
|
+
6
|
167
|
+
7
|
168
|
+
8
|
169
|
+
9
|
170
|
+
10
|
171
|
+
11
|
172
|
+
12
|
173
|
+
13
|
174
|
+
14
|
175
|
+
15
|
176
|
+
16
|
177
|
+
17</pre>
|
178
|
+
</td>
|
179
|
+
<td>
|
180
|
+
<pre class="code"><span class="info file"># File 'lib/schemacop/dupper.rb', line 3</span>
|
181
|
+
|
182
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_dup_data'>dup_data</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
|
183
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='rparen'>)</span>
|
184
|
+
<span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_dup'>dup</span>
|
185
|
+
|
186
|
+
<span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
|
187
|
+
<span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_dup_data'>dup_data</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
188
|
+
<span class='kw'>end</span>
|
189
|
+
|
190
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_data'>data</span>
|
191
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Array</span><span class='rparen'>)</span>
|
192
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_value'>value</span><span class='op'>|</span> <span class='id identifier rubyid_dup_data'>dup_data</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
193
|
+
<span class='kw'>else</span>
|
194
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_data'>data</span>
|
195
|
+
<span class='kw'>end</span>
|
196
|
+
<span class='kw'>end</span></pre>
|
197
|
+
</td>
|
198
|
+
</tr>
|
199
|
+
</table>
|
200
|
+
</div>
|
201
|
+
|
202
|
+
</div>
|
203
|
+
|
204
|
+
</div>
|
205
|
+
|
206
|
+
<div id="footer">
|
207
|
+
Generated on Thu Jul 2 11:30:34 2020 by
|
208
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
209
|
+
0.9.20 (ruby-2.6.2).
|
210
|
+
</div>
|
211
|
+
|
212
|
+
</div>
|
213
|
+
</body>
|
214
|
+
</html>
|
@@ -105,7 +105,7 @@
|
|
105
105
|
</div>
|
106
106
|
|
107
107
|
<div id="footer">
|
108
|
-
Generated on
|
108
|
+
Generated on Thu Jul 2 11:30:34 2020 by
|
109
109
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
110
110
|
0.9.20 (ruby-2.6.2).
|
111
111
|
</div>
|
@@ -114,7 +114,7 @@
|
|
114
114
|
</div>
|
115
115
|
|
116
116
|
<div id="footer">
|
117
|
-
Generated on
|
117
|
+
Generated on Thu Jul 2 11:30:34 2020 by
|
118
118
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
119
119
|
0.9.20 (ruby-2.6.2).
|
120
120
|
</div>
|
@@ -114,7 +114,7 @@
|
|
114
114
|
</div>
|
115
115
|
|
116
116
|
<div id="footer">
|
117
|
-
Generated on
|
117
|
+
Generated on Thu Jul 2 11:30:34 2020 by
|
118
118
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
119
119
|
0.9.20 (ruby-2.6.2).
|
120
120
|
</div>
|
@@ -411,7 +411,7 @@
|
|
411
411
|
</div>
|
412
412
|
|
413
413
|
<div id="footer">
|
414
|
-
Generated on
|
414
|
+
Generated on Thu Jul 2 11:30:34 2020 by
|
415
415
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
416
416
|
0.9.20 (ruby-2.6.2).
|
417
417
|
</div>
|
@@ -148,7 +148,7 @@
|
|
148
148
|
</div>
|
149
149
|
|
150
150
|
<div id="footer">
|
151
|
-
Generated on
|
151
|
+
Generated on Thu Jul 2 11:30:34 2020 by
|
152
152
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
153
153
|
0.9.20 (ruby-2.6.2).
|
154
154
|
</div>
|
@@ -215,8 +215,6 @@
|
|
215
215
|
<pre class="lines">
|
216
216
|
|
217
217
|
|
218
|
-
5
|
219
|
-
6
|
220
218
|
7
|
221
219
|
8
|
222
220
|
9
|
@@ -239,10 +237,14 @@
|
|
239
237
|
26
|
240
238
|
27
|
241
239
|
28
|
242
|
-
29
|
240
|
+
29
|
241
|
+
30
|
242
|
+
31
|
243
|
+
32
|
244
|
+
33</pre>
|
243
245
|
</td>
|
244
246
|
<td>
|
245
|
-
<pre class="code"><span class="info file"># File 'lib/schemacop/validator/hash_validator.rb', line
|
247
|
+
<pre class="code"><span class="info file"># File 'lib/schemacop/validator/hash_validator.rb', line 7</span>
|
246
248
|
|
247
249
|
<span class='kw'>def</span> <span class='id identifier rubyid_validate'>validate</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='id identifier rubyid_collector'>collector</span><span class='rparen'>)</span>
|
248
250
|
<span class='kw'>super</span>
|
@@ -263,7 +265,9 @@
|
|
263
265
|
|
264
266
|
<span class='id identifier rubyid_obsolete_keys'>obsolete_keys</span> <span class='op'>=</span> <span class='id identifier rubyid_data_keys'>data_keys</span> <span class='op'>-</span> <span class='id identifier rubyid_allowed_fields'>allowed_fields</span>
|
265
267
|
|
266
|
-
<span class='
|
268
|
+
<span class='kw'>unless</span> <span class='id identifier rubyid_option?'>option?</span><span class='lparen'>(</span><span class='symbol'>:allow_obsolete_keys</span><span class='rparen'>)</span>
|
269
|
+
<span class='id identifier rubyid_collector'>collector</span><span class='period'>.</span><span class='id identifier rubyid_error'>error</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Obsolete keys: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_obsolete_keys'>obsolete_keys</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_obsolete_keys'>obsolete_keys</span><span class='period'>.</span><span class='id identifier rubyid_any?'>any?</span>
|
270
|
+
<span class='kw'>end</span>
|
267
271
|
|
268
272
|
<span class='ivar'>@fields</span><span class='period'>.</span><span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_field'>field</span><span class='op'>|</span>
|
269
273
|
<span class='id identifier rubyid_field'>field</span><span class='period'>.</span><span class='id identifier rubyid_validate'>validate</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='id identifier rubyid_collector'>collector</span><span class='rparen'>)</span>
|
@@ -279,7 +283,7 @@
|
|
279
283
|
</div>
|
280
284
|
|
281
285
|
<div id="footer">
|
282
|
-
Generated on
|
286
|
+
Generated on Thu Jul 2 11:30:34 2020 by
|
283
287
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
284
288
|
0.9.20 (ruby-2.6.2).
|
285
289
|
</div>
|