schemacop 2.0.0 → 2.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +1 -17
- data/.travis.yml +0 -2
- data/CHANGELOG.md +49 -0
- data/LICENSE +1 -1
- data/README.md +66 -17
- data/Rakefile +5 -1
- data/VERSION +1 -1
- data/doc/Schemacop.html +5 -5
- data/doc/Schemacop/ArrayValidator.html +3 -3
- data/doc/Schemacop/BooleanValidator.html +4 -4
- data/doc/Schemacop/Collector.html +208 -32
- 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 +3 -3
- data/doc/Schemacop/FloatValidator.html +4 -4
- data/doc/Schemacop/HashValidator.html +33 -7
- data/doc/Schemacop/IntegerValidator.html +4 -4
- data/doc/Schemacop/NilValidator.html +4 -4
- data/doc/Schemacop/Node.html +4 -4
- data/doc/Schemacop/NodeResolver.html +3 -3
- data/doc/Schemacop/NodeSupportingField.html +4 -4
- data/doc/Schemacop/NodeSupportingType.html +4 -4
- data/doc/Schemacop/NodeWithBlock.html +4 -4
- data/doc/Schemacop/NumberValidator.html +4 -4
- data/doc/Schemacop/ObjectValidator.html +20 -10
- data/doc/Schemacop/RootNode.html +4 -4
- data/doc/Schemacop/Schema.html +4 -4
- data/doc/Schemacop/StringValidator.html +3 -3
- data/doc/Schemacop/SymbolValidator.html +145 -0
- 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 +76 -30
- data/doc/frames.html +1 -1
- data/doc/index.html +76 -30
- data/doc/js/app.js +55 -0
- data/doc/method_list.html +57 -41
- data/doc/top-level-namespace.html +3 -3
- data/lib/schemacop.rb +2 -0
- data/lib/schemacop/collector.rb +21 -2
- data/lib/schemacop/node.rb +6 -2
- data/lib/schemacop/node_supporting_field.rb +2 -6
- data/lib/schemacop/schema.rb +1 -1
- data/lib/schemacop/validator/hash_validator.rb +15 -2
- data/lib/schemacop/validator/object_validator.rb +7 -1
- data/lib/schemacop/validator/symbol_validator.rb +5 -0
- data/schemacop.gemspec +9 -9
- data/test/collector_test.rb +45 -0
- data/test/custom_check_test.rb +7 -0
- data/test/short_forms_test.rb +15 -0
- data/test/types_test.rb +1 -0
- data/test/validator_object_test.rb +18 -0
- data/test/validator_symbol_test.rb +16 -0
- metadata +23 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f276c94be15a6c27b4c690e71cafe375db73b53984a700205a9b4a78024a31da
|
4
|
+
data.tar.gz: 82dabde2bd0e6fc7fb06a5ebef3b4cf2065e718a0c27bb419960199b9898b145
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6bb7bcb290cffe2bdf0089e98dc977a2d6d90458875cd89d84756cd3749bfd925fa5ff1987fa4b19ad1c89cee52944385d7e84ea8e8dea417db8c7cb007a4507
|
7
|
+
data.tar.gz: 3d3122e09ff0aaed4605daec77228afbf38b02e604c0498bb8cd8c7a6bb5a8d17914378ba580f72d6e0155cef4dfa3b192689f7bf6a259d1efd8be82831ce746
|
data/.rubocop.yml
CHANGED
@@ -1,6 +1,4 @@
|
|
1
1
|
AllCops:
|
2
|
-
TargetRubyVersion: 2.3
|
3
|
-
|
4
2
|
Exclude:
|
5
3
|
- 'local/**/*'
|
6
4
|
- 'vendor/**/*'
|
@@ -10,21 +8,13 @@ AllCops:
|
|
10
8
|
- 'db/schema.rb'
|
11
9
|
- 'locale/translations.rb'
|
12
10
|
- 'lib/scratch.rb'
|
11
|
+
- 'schemacop.gemspec'
|
13
12
|
|
14
13
|
DisplayCopNames: true
|
15
14
|
|
16
|
-
Style/FrozenStringLiteralComment:
|
17
|
-
Enabled: false
|
18
|
-
|
19
15
|
Style/SignalException:
|
20
16
|
EnforcedStyle: only_fail
|
21
17
|
|
22
|
-
Style/ConditionalAssignment:
|
23
|
-
Enabled: false
|
24
|
-
|
25
|
-
Style/IndentArray:
|
26
|
-
EnforcedStyle: consistent
|
27
|
-
|
28
18
|
Metrics/MethodLength:
|
29
19
|
Enabled: false
|
30
20
|
|
@@ -53,9 +43,6 @@ Metrics/LineLength:
|
|
53
43
|
Metrics/BlockNesting:
|
54
44
|
Enabled: false
|
55
45
|
|
56
|
-
Metrics/BlockLength:
|
57
|
-
Enabled: false
|
58
|
-
|
59
46
|
Style/IfUnlessModifier:
|
60
47
|
Enabled: false
|
61
48
|
|
@@ -93,8 +80,5 @@ Style/ClassAndModuleChildren:
|
|
93
80
|
#
|
94
81
|
# The compact style is only forced, for classes / modules with one child.
|
95
82
|
|
96
|
-
Style/NumericPredicate:
|
97
|
-
Enabled: false
|
98
|
-
|
99
83
|
Style/FormatString:
|
100
84
|
Enabled: false
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -10,6 +10,55 @@
|
|
10
10
|
### Changes
|
11
11
|
-->
|
12
12
|
|
13
|
+
## 2.3.2 (2019-09-26)
|
14
|
+
|
15
|
+
### New features
|
16
|
+
|
17
|
+
* Add ability to return custom error messages from `:check` blocks
|
18
|
+
|
19
|
+
## 2.3.1 (2019-08-19)
|
20
|
+
|
21
|
+
### Changes
|
22
|
+
|
23
|
+
* Make compatible with Rails 6
|
24
|
+
|
25
|
+
## 2.3.0 (2017-05-18)
|
26
|
+
|
27
|
+
### New features
|
28
|
+
|
29
|
+
* Option `strict` for the Type `:object`
|
30
|
+
|
31
|
+
This option, which defaults to true, ensures that instance classes are checked
|
32
|
+
strictly. If set to false, instances of derived classes are also allowed.
|
33
|
+
|
34
|
+
### Bug fixes
|
35
|
+
|
36
|
+
* Removed '/root' from the paths in the error messages
|
37
|
+
|
38
|
+
### Changes
|
39
|
+
|
40
|
+
* Added tests for the Collector paths to ensure correct behavior
|
41
|
+
* Added symbol Type to the short forms test
|
42
|
+
|
43
|
+
## 2.2.0 (2017-05-17)
|
44
|
+
|
45
|
+
### Changes
|
46
|
+
|
47
|
+
* Handle `ActiveSupport::HashWithIndifferentAccess` objects gracefully when
|
48
|
+
performing the validation. This allows the user to specify the schema using
|
49
|
+
a mixture of symbols and strings, but during the validation of a
|
50
|
+
`HashWithIndifferentAccess` it transparently converts the keys, both in the
|
51
|
+
schema and in the hash, to symbols.
|
52
|
+
|
53
|
+
In the event that a key is defined both in the string and symbol version,
|
54
|
+
Schemacop expects a Ruby hash and will throw a ValidationError otherwise.
|
55
|
+
|
56
|
+
## 2.1.0 (2017-05-16)
|
57
|
+
|
58
|
+
### New features
|
59
|
+
|
60
|
+
* Validator for type Symbol, accessible with the symbol `:symbol`
|
61
|
+
|
13
62
|
## 2.0.0 (2017-05-15)
|
14
63
|
|
15
64
|
### Changes
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -79,7 +79,7 @@ end
|
|
79
79
|
At runtime:
|
80
80
|
|
81
81
|
```ruby
|
82
|
-
|
82
|
+
my_schema.validate!(
|
83
83
|
# Your data goes here
|
84
84
|
)
|
85
85
|
```
|
@@ -108,7 +108,7 @@ this:
|
|
108
108
|
s = Schema.new do
|
109
109
|
type :integer
|
110
110
|
type :hash do
|
111
|
-
req '
|
111
|
+
req 'present' do
|
112
112
|
type :boolean
|
113
113
|
end
|
114
114
|
end
|
@@ -182,7 +182,7 @@ Consider a scenario in which you want to have the following rule set:
|
|
182
182
|
The corresponding schema would look as follows:
|
183
183
|
|
184
184
|
```ruby
|
185
|
-
|
185
|
+
Schema.new do
|
186
186
|
type :integer, if: proc { |data| data.odd? }, max: 15
|
187
187
|
type :integer
|
188
188
|
end
|
@@ -203,8 +203,8 @@ the type checking, meaning that it only gets executed if the data has the right
|
|
203
203
|
type and the proc in `if` (if any) has returned true.
|
204
204
|
|
205
205
|
The proc passed to the `check` option is given the data being analyzed. It is to
|
206
|
-
return true if the data passes the custom check. If it returns false
|
207
|
-
considers the data to be invalid.
|
206
|
+
return true if the data passes the custom check. If it returns false or an error
|
207
|
+
message as a string, Schemacop considers the data to be invalid.
|
208
208
|
|
209
209
|
The following example illustrates the use of the option `check`: Consider a
|
210
210
|
scenario in which you want the following rule set:
|
@@ -224,10 +224,21 @@ end
|
|
224
224
|
The above Type Line has type `:string` and two options (`min` and `check`). The
|
225
225
|
option `min` is supported by the `:string` validator (covered later).
|
226
226
|
|
227
|
+
You can also specify a custom error message by returning a string:
|
228
|
+
|
229
|
+
|
230
|
+
```ruby
|
231
|
+
Schema.new do
|
232
|
+
type :integer, check: proc { |i| i.even? ? true : 'Custom error' }
|
233
|
+
end
|
234
|
+
```
|
235
|
+
|
236
|
+
This will include `Custom error` in the validation error message.
|
237
|
+
|
227
238
|
### Field Line
|
228
239
|
|
229
|
-
Inside a Type Line of type `:hash
|
230
|
-
|
240
|
+
Inside a Type Line of type `:hash`, you may specify an arbitrary number of field
|
241
|
+
lines (one for each key-value pair you want to be in the hash).
|
231
242
|
|
232
243
|
Field Lines start with one of the following six identifiers: `req`, `req?`,
|
233
244
|
`req!`, `opt`, `opt?` or `opt!`:
|
@@ -273,11 +284,42 @@ end
|
|
273
284
|
You might find the notation cumbersome, and you'd be right to say so. Luckily
|
274
285
|
there are plenty of short forms available which we will see below.
|
275
286
|
|
287
|
+
#### Handling hashes with indifferent access
|
288
|
+
|
289
|
+
Schemacop has special handling for objects of the class
|
290
|
+
`ActiveSupport::HashWithIndifferentAccess`: You may specify the keys as symbols
|
291
|
+
or strings, and Schemacop will handle the conversion necessary for proper
|
292
|
+
validation internally. Note that if you define the same key as string and
|
293
|
+
symbol, it will throw a `ValidationError` [exception](#exceptions) when asked to
|
294
|
+
validate a hash with indifferent access.
|
295
|
+
|
296
|
+
Thus, the following two schema definitions are equivalent when validating a hash
|
297
|
+
with indifferent access:
|
298
|
+
|
299
|
+
```ruby
|
300
|
+
Schema.new do
|
301
|
+
type :hash do
|
302
|
+
req :name do
|
303
|
+
type :string
|
304
|
+
end
|
305
|
+
end
|
306
|
+
end
|
307
|
+
|
308
|
+
Schema.new do
|
309
|
+
type :hash do
|
310
|
+
req 'name' do
|
311
|
+
type :string
|
312
|
+
end
|
313
|
+
end
|
314
|
+
end
|
315
|
+
```
|
316
|
+
|
276
317
|
## Types
|
277
318
|
|
278
|
-
|
279
|
-
|
280
|
-
|
319
|
+
Types are defined via their validators, which is a class under `validator/`.
|
320
|
+
Each validator is sourced by `schemacop.rb`.
|
321
|
+
|
322
|
+
The following types are supported by Schemacop by default:
|
281
323
|
|
282
324
|
* `:boolean` accepts a Ruby TrueClass or FalseClass instance.
|
283
325
|
|
@@ -297,13 +339,20 @@ another `your_validator.rb` class under `validator/`): -->
|
|
297
339
|
|
298
340
|
- supported options: `min`, `max` (bounds for string length)
|
299
341
|
|
342
|
+
* `:symbol` accepts a Ruby Symbol.
|
343
|
+
|
300
344
|
* `:object` accepts an arbitrary Ruby object (any object if no option is given).
|
301
345
|
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
346
|
+
Supported options:
|
347
|
+
|
348
|
+
- `classes`: Ruby class (or an array of them) that will be the only recognized
|
349
|
+
filters. Unlike other options, this one affects not the validation but the
|
350
|
+
type recognition, meaning that you can have multiple Type Lines with
|
351
|
+
different `classes` option for the same field, each having its own
|
352
|
+
validation (e.g. through the option `check`).
|
353
|
+
|
354
|
+
- `strict`: Boolean option, defaults to true. If set to false, the validator
|
355
|
+
also allows derived classes of those specified with `classes`.
|
307
356
|
|
308
357
|
* `:array` accepts a Ruby Array.
|
309
358
|
|
@@ -314,7 +363,7 @@ another `your_validator.rb` class under `validator/`): -->
|
|
314
363
|
- TODO no lookahead for different arrays, see
|
315
364
|
validator_array_test#test_multiple_arrays
|
316
365
|
|
317
|
-
* `:hash` accepts a Ruby Hash
|
366
|
+
* `:hash` accepts a Ruby Hash or an `ActiveSupport::HashWithIndifferentAccess`.
|
318
367
|
|
319
368
|
- accepts a block with an arbitrary number of Field Lines.
|
320
369
|
|
@@ -531,4 +580,4 @@ to [SubGit](http://www.subgit.com/) for their great open source licensing.
|
|
531
580
|
|
532
581
|
## Copyright
|
533
582
|
|
534
|
-
Copyright (c)
|
583
|
+
Copyright (c) 2019 Sitrox. See `LICENSE` for further details.
|
data/Rakefile
CHANGED
@@ -18,11 +18,15 @@ task :gemspec do
|
|
18
18
|
spec.add_development_dependency 'rake'
|
19
19
|
spec.add_development_dependency 'ci_reporter', '~> 2.0'
|
20
20
|
spec.add_development_dependency 'ci_reporter_minitest'
|
21
|
-
spec.add_development_dependency 'activesupport'
|
22
21
|
spec.add_development_dependency 'haml'
|
23
22
|
spec.add_development_dependency 'yard'
|
24
23
|
spec.add_development_dependency 'rubocop', '0.35.1'
|
25
24
|
spec.add_development_dependency 'redcarpet'
|
25
|
+
|
26
|
+
# This lower bound for ActiveSupport is not necessarily true. Schemacop
|
27
|
+
# needs access to ActiveSupport::HashWithIndifferentAccess and expects
|
28
|
+
# behavior of that as in version 5 of ActiveSupport.
|
29
|
+
spec.add_dependency 'activesupport', '>= 4.0'
|
26
30
|
end
|
27
31
|
|
28
32
|
File.open('schemacop.gemspec', 'w') { |f| f.write(gemspec.to_ruby.strip) }
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.3.2
|
data/doc/Schemacop.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Module: Schemacop
|
8
8
|
|
9
|
-
— Documentation by YARD 0.9.
|
9
|
+
— Documentation by YARD 0.9.20
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -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/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/boolean_validator.rb,<br /> lib/schemacop/validator/integer_validator.rb</span>
|
82
|
+
lib/schemacop/node.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/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>
|
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/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>
|
97
97
|
|
98
98
|
|
99
99
|
</p>
|
@@ -109,9 +109,9 @@
|
|
109
109
|
</div>
|
110
110
|
|
111
111
|
<div id="footer">
|
112
|
-
Generated on
|
112
|
+
Generated on Thu Sep 26 13:19:46 2019 by
|
113
113
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
114
|
-
0.9.
|
114
|
+
0.9.20 (ruby-2.6.2).
|
115
115
|
</div>
|
116
116
|
|
117
117
|
</div>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Class: Schemacop::ArrayValidator
|
8
8
|
|
9
|
-
— Documentation by YARD 0.9.
|
9
|
+
— Documentation by YARD 0.9.20
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -319,9 +319,9 @@
|
|
319
319
|
</div>
|
320
320
|
|
321
321
|
<div id="footer">
|
322
|
-
Generated on
|
322
|
+
Generated on Thu Sep 26 13:19:47 2019 by
|
323
323
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
324
|
-
0.9.
|
324
|
+
0.9.20 (ruby-2.6.2).
|
325
325
|
</div>
|
326
326
|
|
327
327
|
</div>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Class: Schemacop::BooleanValidator
|
8
8
|
|
9
|
-
— Documentation by YARD 0.9.
|
9
|
+
— Documentation by YARD 0.9.20
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -123,7 +123,7 @@
|
|
123
123
|
<h2>Method Summary</h2>
|
124
124
|
|
125
125
|
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Node.html" title="Schemacop::Node (class)">Node</a></span></h3>
|
126
|
-
<p class="inherited"><span class='object_link'><a href="Node.html#build-class_method" title="Schemacop::Node.build (method)">build</a></span>, <span class='object_link'><a href="Node.html#class_matches%3F-class_method" title="Schemacop::Node.class_matches? (method)">class_matches?</a></span>, <span class='object_link'><a href="Node.html#clear_klasses-class_method" title="Schemacop::Node.clear_klasses (method)">clear_klasses</a></span>, <span class='object_link'><a href="Node.html#clear_symbols-class_method" title="Schemacop::Node.clear_symbols (method)">clear_symbols</a></span>, <span class='object_link'><a href="Node.html#exec_block-instance_method" title="Schemacop::Node#exec_block (method)">#exec_block</a></span>, <span class='object_link'><a href="Node.html#initialize-instance_method" title="Schemacop::Node#initialize (method)">#initialize</a></span>, <span class='object_link'><a href="Node.html#klass-class_method" title="Schemacop::Node.klass (method)">klass</a></span>, <span class='object_link'><a href="Node.html#option-class_method" title="Schemacop::Node.option (method)">option</a></span>, <span class='object_link'><a href="Node.html#option-instance_method" title="Schemacop::Node#option (method)">#option</a></span>, <span class='object_link'><a href="Node.html#option%3F-instance_method" title="Schemacop::Node#option? (method)">#option?</a></span>, <span class='object_link'><a href="Node.html#register-class_method" title="Schemacop::Node.register (method)">register</a></span>, <span class='object_link'><a href="Node.html#resolve_type_klass-instance_method" title="Schemacop::Node#resolve_type_klass (method)">#resolve_type_klass</a></span>, <span class='object_link'><a href="Node.html#symbol-class_method" title="Schemacop::Node.symbol (method)">symbol</a></span>, <span class='object_link'><a href="Node.html#symbol_matches%3F-class_method" title="Schemacop::Node.symbol_matches? (method)">symbol_matches?</a></span>, <span class='object_link'><a href="Node.html#type_filter_matches%3F-instance_method" title="Schemacop::Node#type_filter_matches? (method)">#type_filter_matches?</a></span>, <span class='object_link'><a href="Node.html#type_label-instance_method" title="Schemacop::Node#type_label (method)">#type_label</a></span>, <span class='object_link'><a href="Node.html#type_matches%3F-
|
126
|
+
<p class="inherited"><span class='object_link'><a href="Node.html#build-class_method" title="Schemacop::Node.build (method)">build</a></span>, <span class='object_link'><a href="Node.html#class_matches%3F-class_method" title="Schemacop::Node.class_matches? (method)">class_matches?</a></span>, <span class='object_link'><a href="Node.html#clear_klasses-class_method" title="Schemacop::Node.clear_klasses (method)">clear_klasses</a></span>, <span class='object_link'><a href="Node.html#clear_symbols-class_method" title="Schemacop::Node.clear_symbols (method)">clear_symbols</a></span>, <span class='object_link'><a href="Node.html#exec_block-instance_method" title="Schemacop::Node#exec_block (method)">#exec_block</a></span>, <span class='object_link'><a href="Node.html#initialize-instance_method" title="Schemacop::Node#initialize (method)">#initialize</a></span>, <span class='object_link'><a href="Node.html#klass-class_method" title="Schemacop::Node.klass (method)">klass</a></span>, <span class='object_link'><a href="Node.html#option-class_method" title="Schemacop::Node.option (method)">option</a></span>, <span class='object_link'><a href="Node.html#option-instance_method" title="Schemacop::Node#option (method)">#option</a></span>, <span class='object_link'><a href="Node.html#option%3F-instance_method" title="Schemacop::Node#option? (method)">#option?</a></span>, <span class='object_link'><a href="Node.html#register-class_method" title="Schemacop::Node.register (method)">register</a></span>, <span class='object_link'><a href="Node.html#resolve_type_klass-instance_method" title="Schemacop::Node#resolve_type_klass (method)">#resolve_type_klass</a></span>, <span class='object_link'><a href="Node.html#symbol-class_method" title="Schemacop::Node.symbol (method)">symbol</a></span>, <span class='object_link'><a href="Node.html#symbol_matches%3F-class_method" title="Schemacop::Node.symbol_matches? (method)">symbol_matches?</a></span>, <span class='object_link'><a href="Node.html#type_filter_matches%3F-instance_method" title="Schemacop::Node#type_filter_matches? (method)">#type_filter_matches?</a></span>, <span class='object_link'><a href="Node.html#type_label-instance_method" title="Schemacop::Node#type_label (method)">#type_label</a></span>, <span class='object_link'><a href="Node.html#type_matches%3F-instance_method" title="Schemacop::Node#type_matches? (method)">#type_matches?</a></span>, <span class='object_link'><a href="Node.html#type_matches%3F-class_method" title="Schemacop::Node.type_matches? (method)">type_matches?</a></span>, <span class='object_link'><a href="Node.html#validate-instance_method" title="Schemacop::Node#validate (method)">#validate</a></span></p>
|
127
127
|
<div id="constructor_details" class="method_details_list">
|
128
128
|
<h2>Constructor Details</h2>
|
129
129
|
|
@@ -135,9 +135,9 @@
|
|
135
135
|
</div>
|
136
136
|
|
137
137
|
<div id="footer">
|
138
|
-
Generated on
|
138
|
+
Generated on Thu Sep 26 13:19:47 2019 by
|
139
139
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
140
|
-
0.9.
|
140
|
+
0.9.20 (ruby-2.6.2).
|
141
141
|
</div>
|
142
142
|
|
143
143
|
</div>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Class: Schemacop::Collector
|
8
8
|
|
9
|
-
— Documentation by YARD 0.9.
|
9
|
+
— Documentation by YARD 0.9.20
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -131,6 +131,34 @@
|
|
131
131
|
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute current_path.</p>
|
132
132
|
</div></span>
|
133
133
|
|
134
|
+
</li>
|
135
|
+
|
136
|
+
|
137
|
+
<li class="public ">
|
138
|
+
<span class="summary_signature">
|
139
|
+
|
140
|
+
<a href="#exceptions-instance_method" title="#exceptions (instance method)">#<strong>exceptions</strong> ⇒ Object </a>
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
</span>
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
<span class="note title readonly">readonly</span>
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute exceptions.</p>
|
160
|
+
</div></span>
|
161
|
+
|
134
162
|
</li>
|
135
163
|
|
136
164
|
|
@@ -188,6 +216,29 @@
|
|
188
216
|
|
189
217
|
<span class="summary_desc"><div class='inline'></div></span>
|
190
218
|
|
219
|
+
</li>
|
220
|
+
|
221
|
+
|
222
|
+
<li class="public ">
|
223
|
+
<span class="summary_signature">
|
224
|
+
|
225
|
+
<a href="#ignore_next_segment-instance_method" title="#ignore_next_segment (instance method)">#<strong>ignore_next_segment</strong> ⇒ Schemacop::Collector </a>
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
</span>
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
<span class="summary_desc"><div class='inline'><p>Does not include the path segment next time path is called.</p>
|
240
|
+
</div></span>
|
241
|
+
|
191
242
|
</li>
|
192
243
|
|
193
244
|
|
@@ -233,7 +284,8 @@
|
|
233
284
|
|
234
285
|
|
235
286
|
|
236
|
-
<span class="summary_desc"><div class='inline'
|
287
|
+
<span class="summary_desc"><div class='inline'><p>Construct the current path.</p>
|
288
|
+
</div></span>
|
237
289
|
|
238
290
|
</li>
|
239
291
|
|
@@ -291,17 +343,19 @@
|
|
291
343
|
<pre class="lines">
|
292
344
|
|
293
345
|
|
294
|
-
5
|
295
346
|
6
|
296
347
|
7
|
297
|
-
8
|
348
|
+
8
|
349
|
+
9
|
350
|
+
10</pre>
|
298
351
|
</td>
|
299
352
|
<td>
|
300
|
-
<pre class="code"><span class="info file"># File 'lib/schemacop/collector.rb', line
|
353
|
+
<pre class="code"><span class="info file"># File 'lib/schemacop/collector.rb', line 6</span>
|
301
354
|
|
302
355
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
|
303
356
|
<span class='ivar'>@exceptions</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
304
357
|
<span class='ivar'>@current_path</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
358
|
+
<span class='ivar'>@ignore_next_segment</span> <span class='op'>=</span> <span class='kw'>false</span>
|
305
359
|
<span class='kw'>end</span></pre>
|
306
360
|
</td>
|
307
361
|
</tr>
|
@@ -355,6 +409,48 @@
|
|
355
409
|
</table>
|
356
410
|
</div>
|
357
411
|
|
412
|
+
|
413
|
+
<span id=""></span>
|
414
|
+
<div class="method_details ">
|
415
|
+
<h3 class="signature " id="exceptions-instance_method">
|
416
|
+
|
417
|
+
#<strong>exceptions</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
418
|
+
|
419
|
+
|
420
|
+
|
421
|
+
|
422
|
+
|
423
|
+
</h3><div class="docstring">
|
424
|
+
<div class="discussion">
|
425
|
+
<p>Returns the value of attribute exceptions</p>
|
426
|
+
|
427
|
+
|
428
|
+
</div>
|
429
|
+
</div>
|
430
|
+
<div class="tags">
|
431
|
+
|
432
|
+
|
433
|
+
</div><table class="source_code">
|
434
|
+
<tr>
|
435
|
+
<td>
|
436
|
+
<pre class="lines">
|
437
|
+
|
438
|
+
|
439
|
+
4
|
440
|
+
5
|
441
|
+
6</pre>
|
442
|
+
</td>
|
443
|
+
<td>
|
444
|
+
<pre class="code"><span class="info file"># File 'lib/schemacop/collector.rb', line 4</span>
|
445
|
+
|
446
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_exceptions'>exceptions</span>
|
447
|
+
<span class='ivar'>@exceptions</span>
|
448
|
+
<span class='kw'>end</span></pre>
|
449
|
+
</td>
|
450
|
+
</tr>
|
451
|
+
</table>
|
452
|
+
</div>
|
453
|
+
|
358
454
|
</div>
|
359
455
|
|
360
456
|
|
@@ -377,15 +473,15 @@
|
|
377
473
|
<pre class="lines">
|
378
474
|
|
379
475
|
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
476
|
+
37
|
477
|
+
38
|
478
|
+
39
|
479
|
+
40
|
480
|
+
41
|
481
|
+
42</pre>
|
386
482
|
</td>
|
387
483
|
<td>
|
388
|
-
<pre class="code"><span class="info file"># File 'lib/schemacop/collector.rb', line
|
484
|
+
<pre class="code"><span class="info file"># File 'lib/schemacop/collector.rb', line 37</span>
|
389
485
|
|
390
486
|
<span class='kw'>def</span> <span class='id identifier rubyid_error'>error</span><span class='lparen'>(</span><span class='id identifier rubyid_error_msg'>error_msg</span><span class='rparen'>)</span>
|
391
487
|
<span class='ivar'>@exceptions</span> <span class='op'><<</span> <span class='lbrace'>{</span>
|
@@ -413,14 +509,14 @@
|
|
413
509
|
<pre class="lines">
|
414
510
|
|
415
511
|
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
512
|
+
31
|
513
|
+
32
|
514
|
+
33
|
515
|
+
34
|
516
|
+
35</pre>
|
421
517
|
</td>
|
422
518
|
<td>
|
423
|
-
<pre class="code"><span class="info file"># File 'lib/schemacop/collector.rb', line
|
519
|
+
<pre class="code"><span class="info file"># File 'lib/schemacop/collector.rb', line 31</span>
|
424
520
|
|
425
521
|
<span class='kw'>def</span> <span class='id identifier rubyid_exception_message'>exception_message</span>
|
426
522
|
<span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Schemacop validation failed:\n</span><span class='tstring_end'>"</span></span> <span class='op'>+</span> <span class='ivar'>@exceptions</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_e'>e</span><span class='op'>|</span>
|
@@ -430,6 +526,62 @@
|
|
430
526
|
</td>
|
431
527
|
</tr>
|
432
528
|
</table>
|
529
|
+
</div>
|
530
|
+
|
531
|
+
<div class="method_details ">
|
532
|
+
<h3 class="signature " id="ignore_next_segment-instance_method">
|
533
|
+
|
534
|
+
#<strong>ignore_next_segment</strong> ⇒ <tt><span class='object_link'><a href="" title="Schemacop::Collector (class)">Schemacop::Collector</a></span></tt>
|
535
|
+
|
536
|
+
|
537
|
+
|
538
|
+
|
539
|
+
|
540
|
+
</h3><div class="docstring">
|
541
|
+
<div class="discussion">
|
542
|
+
<p>Does not include the path segment next time path is
|
543
|
+
called.</p>
|
544
|
+
|
545
|
+
|
546
|
+
</div>
|
547
|
+
</div>
|
548
|
+
<div class="tags">
|
549
|
+
|
550
|
+
<p class="tag_title">Returns:</p>
|
551
|
+
<ul class="return">
|
552
|
+
|
553
|
+
<li>
|
554
|
+
|
555
|
+
|
556
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="Schemacop::Collector (class)">Schemacop::Collector</a></span></tt>)</span>
|
557
|
+
|
558
|
+
|
559
|
+
|
560
|
+
</li>
|
561
|
+
|
562
|
+
</ul>
|
563
|
+
|
564
|
+
</div><table class="source_code">
|
565
|
+
<tr>
|
566
|
+
<td>
|
567
|
+
<pre class="lines">
|
568
|
+
|
569
|
+
|
570
|
+
48
|
571
|
+
49
|
572
|
+
50
|
573
|
+
51</pre>
|
574
|
+
</td>
|
575
|
+
<td>
|
576
|
+
<pre class="code"><span class="info file"># File 'lib/schemacop/collector.rb', line 48</span>
|
577
|
+
|
578
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_ignore_next_segment'>ignore_next_segment</span>
|
579
|
+
<span class='ivar'>@ignore_next_segment</span> <span class='op'>=</span> <span class='kw'>true</span>
|
580
|
+
<span class='kw'>return</span> <span class='kw'>self</span>
|
581
|
+
<span class='kw'>end</span></pre>
|
582
|
+
</td>
|
583
|
+
</tr>
|
584
|
+
</table>
|
433
585
|
</div>
|
434
586
|
|
435
587
|
<div class="method_details ">
|
@@ -441,27 +593,51 @@
|
|
441
593
|
|
442
594
|
|
443
595
|
|
444
|
-
</h3><
|
596
|
+
</h3><div class="docstring">
|
597
|
+
<div class="discussion">
|
598
|
+
<p>Construct the current path</p>
|
599
|
+
|
600
|
+
|
601
|
+
</div>
|
602
|
+
</div>
|
603
|
+
<div class="tags">
|
604
|
+
|
605
|
+
|
606
|
+
</div><table class="source_code">
|
445
607
|
<tr>
|
446
608
|
<td>
|
447
609
|
<pre class="lines">
|
448
610
|
|
449
611
|
|
450
|
-
14
|
451
|
-
15
|
452
|
-
16
|
453
612
|
17
|
454
613
|
18
|
455
|
-
19
|
614
|
+
19
|
615
|
+
20
|
616
|
+
21
|
617
|
+
22
|
618
|
+
23
|
619
|
+
24
|
620
|
+
25
|
621
|
+
26
|
622
|
+
27
|
623
|
+
28
|
624
|
+
29</pre>
|
456
625
|
</td>
|
457
626
|
<td>
|
458
|
-
<pre class="code"><span class="info file"># File 'lib/schemacop/collector.rb', line
|
627
|
+
<pre class="code"><span class="info file"># File 'lib/schemacop/collector.rb', line 17</span>
|
459
628
|
|
460
629
|
<span class='kw'>def</span> <span class='id identifier rubyid_path'>path</span><span class='lparen'>(</span><span class='id identifier rubyid_segment'>segment</span><span class='rparen'>)</span>
|
461
|
-
<span class='
|
630
|
+
<span class='id identifier rubyid_ignore_this_segment'>ignore_this_segment</span> <span class='op'>=</span> <span class='kw'>false</span>
|
631
|
+
<span class='kw'>if</span> <span class='ivar'>@ignore_next_segment</span>
|
632
|
+
<span class='id identifier rubyid_ignore_this_segment'>ignore_this_segment</span> <span class='op'>=</span> <span class='kw'>true</span>
|
633
|
+
<span class='ivar'>@ignore_next_segment</span> <span class='op'>=</span> <span class='kw'>false</span>
|
634
|
+
<span class='kw'>end</span>
|
635
|
+
|
636
|
+
<span class='ivar'>@current_path</span> <span class='op'><<</span> <span class='id identifier rubyid_segment'>segment</span> <span class='kw'>unless</span> <span class='id identifier rubyid_ignore_this_segment'>ignore_this_segment</span>
|
637
|
+
|
462
638
|
<span class='kw'>yield</span>
|
463
639
|
<span class='kw'>ensure</span>
|
464
|
-
<span class='ivar'>@current_path</span><span class='period'>.</span><span class='id identifier rubyid_pop'>pop</span>
|
640
|
+
<span class='ivar'>@current_path</span><span class='period'>.</span><span class='id identifier rubyid_pop'>pop</span> <span class='kw'>unless</span> <span class='id identifier rubyid_ignore_this_segment'>ignore_this_segment</span>
|
465
641
|
<span class='kw'>end</span></pre>
|
466
642
|
</td>
|
467
643
|
</tr>
|
@@ -505,12 +681,12 @@
|
|
505
681
|
<pre class="lines">
|
506
682
|
|
507
683
|
|
508
|
-
|
509
|
-
|
510
|
-
|
684
|
+
12
|
685
|
+
13
|
686
|
+
14</pre>
|
511
687
|
</td>
|
512
688
|
<td>
|
513
|
-
<pre class="code"><span class="info file"># File 'lib/schemacop/collector.rb', line
|
689
|
+
<pre class="code"><span class="info file"># File 'lib/schemacop/collector.rb', line 12</span>
|
514
690
|
|
515
691
|
<span class='kw'>def</span> <span class='id identifier rubyid_valid?'>valid?</span>
|
516
692
|
<span class='ivar'>@exceptions</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
@@ -525,9 +701,9 @@
|
|
525
701
|
</div>
|
526
702
|
|
527
703
|
<div id="footer">
|
528
|
-
Generated on
|
704
|
+
Generated on Thu Sep 26 13:19:46 2019 by
|
529
705
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
530
|
-
0.9.
|
706
|
+
0.9.20 (ruby-2.6.2).
|
531
707
|
</div>
|
532
708
|
|
533
709
|
</div>
|