schemacop 2.3.0 → 2.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 284778e0dc9374078941733ba45f3dab360ff90f275d23eaee3c882c1ace0b5e
|
4
|
+
data.tar.gz: 588efa687de9242df98e10ebe3772dafdbd0ad8252be77d093a41cde0c6edf70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a19de3aa6914daf4287b76573d1cf19cc922b1d17b8b65d9d588dfe2775d2c6143f2b1543fd829b99533971730b984d2e1d058d3aee754fc4bc110d6b2b6e9b2
|
7
|
+
data.tar.gz: 021a2c156fdef4fe95f42e4f7b498fcf28eb5ba1adaa6ec1163da67bebb70f82971b88a828083d92cc8d6637d25569529b9e419744dd884326d01a6d98d4dd18
|
data/CHANGELOG.md
CHANGED
@@ -10,6 +10,47 @@
|
|
10
10
|
### Changes
|
11
11
|
-->
|
12
12
|
|
13
|
+
## 2.4.2 (2019-11-05)
|
14
|
+
|
15
|
+
### Bug fixes
|
16
|
+
|
17
|
+
* The object validator, if given no classes, now supports any object of classes
|
18
|
+
that derive from `BasicObject`. This allows you to specify types that reside
|
19
|
+
out of the ruby standard library, such as `Tempfile`.
|
20
|
+
|
21
|
+
## 2.4.1 (2019-10-28)
|
22
|
+
|
23
|
+
### Bug fixes
|
24
|
+
|
25
|
+
* Re-format code to comply with rubocop. There are no functional implications.
|
26
|
+
|
27
|
+
## 2.4.0 (2019-10-28)
|
28
|
+
|
29
|
+
### New features
|
30
|
+
|
31
|
+
* Add support for default values
|
32
|
+
|
33
|
+
* Add support for type casting
|
34
|
+
|
35
|
+
### Bug fixes
|
36
|
+
|
37
|
+
* Change order of built-in validators so that `Integer` and `String` come
|
38
|
+
*before* `Number` which matches both.
|
39
|
+
|
40
|
+
### Changes
|
41
|
+
|
42
|
+
## 2.3.2 (2019-09-26)
|
43
|
+
|
44
|
+
### New features
|
45
|
+
|
46
|
+
* Add ability to return custom error messages from `:check` blocks
|
47
|
+
|
48
|
+
## 2.3.1 (2019-08-19)
|
49
|
+
|
50
|
+
### Changes
|
51
|
+
|
52
|
+
* Make compatible with Rails 6
|
53
|
+
|
13
54
|
## 2.3.0 (2017-05-18)
|
14
55
|
|
15
56
|
### New features
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -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
|
@@ -124,12 +124,40 @@ We will see Type and Field lines in more detail below.
|
|
124
124
|
### `validate` vs `validate!` vs `valid?`
|
125
125
|
|
126
126
|
The method `validate` will return a `Collector` object that contains all
|
127
|
-
validation errors (if any)
|
128
|
-
and
|
127
|
+
validation errors (if any) as well as a deep copy of your data with applied
|
128
|
+
defaults and castings, whereas `validate!` will accumulate all violations
|
129
|
+
and finally throw an exception describing them or, if the validation was
|
130
|
+
successful, a deep-copy of your supplied data with defaults and castings
|
131
|
+
applied.
|
129
132
|
|
130
133
|
For simply querying the validity of some data, use the methods `valid?` or
|
131
134
|
`invalid?`.
|
132
135
|
|
136
|
+
Examples:
|
137
|
+
|
138
|
+
```ruby
|
139
|
+
# validate! returns your modified data or throws a validation error
|
140
|
+
s = Schema.new do
|
141
|
+
req :foo, default: 42
|
142
|
+
end
|
143
|
+
s.validate!({}) # => { foo: 42 }
|
144
|
+
|
145
|
+
# validate returns a collector
|
146
|
+
s = Schema.new do
|
147
|
+
req :foo, default: 42
|
148
|
+
end
|
149
|
+
|
150
|
+
collector = s.validate({})
|
151
|
+
collector.valid? # true
|
152
|
+
collector.data # => { foo: 42 }
|
153
|
+
|
154
|
+
collector = s.validate({ foo: 'invalid' })
|
155
|
+
collector.valid? # false
|
156
|
+
collector.data # => nil
|
157
|
+
collector.exceptions # => Validation error
|
158
|
+
```
|
159
|
+
|
160
|
+
|
133
161
|
## Schemacop's DSL
|
134
162
|
|
135
163
|
In this section, we will ignore [short forms](#short-forms) and explicitly
|
@@ -182,7 +210,7 @@ Consider a scenario in which you want to have the following rule set:
|
|
182
210
|
The corresponding schema would look as follows:
|
183
211
|
|
184
212
|
```ruby
|
185
|
-
|
213
|
+
Schema.new do
|
186
214
|
type :integer, if: proc { |data| data.odd? }, max: 15
|
187
215
|
type :integer
|
188
216
|
end
|
@@ -203,8 +231,8 @@ the type checking, meaning that it only gets executed if the data has the right
|
|
203
231
|
type and the proc in `if` (if any) has returned true.
|
204
232
|
|
205
233
|
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.
|
234
|
+
return true if the data passes the custom check. If it returns false or an error
|
235
|
+
message as a string, Schemacop considers the data to be invalid.
|
208
236
|
|
209
237
|
The following example illustrates the use of the option `check`: Consider a
|
210
238
|
scenario in which you want the following rule set:
|
@@ -224,6 +252,17 @@ end
|
|
224
252
|
The above Type Line has type `:string` and two options (`min` and `check`). The
|
225
253
|
option `min` is supported by the `:string` validator (covered later).
|
226
254
|
|
255
|
+
You can also specify a custom error message by returning a string:
|
256
|
+
|
257
|
+
|
258
|
+
```ruby
|
259
|
+
Schema.new do
|
260
|
+
type :integer, check: proc { |i| i.even? ? true : 'Custom error' }
|
261
|
+
end
|
262
|
+
```
|
263
|
+
|
264
|
+
This will include `Custom error` in the validation error message.
|
265
|
+
|
227
266
|
### Field Line
|
228
267
|
|
229
268
|
Inside a Type Line of type `:hash`, you may specify an arbitrary number of field
|
@@ -478,6 +517,10 @@ Schema.new do
|
|
478
517
|
end
|
479
518
|
```
|
480
519
|
|
520
|
+
Note that this does not allow you to specify any options for the hash itself.
|
521
|
+
You still need to specify `:hash` as a type if you want to pass any options to
|
522
|
+
the hash (i.e. a `default`).
|
523
|
+
|
481
524
|
### Shortform for subtypes
|
482
525
|
|
483
526
|
In case of nested arrays, you can group all Type Lines to a single one.
|
@@ -536,6 +579,149 @@ of type Array with children of type Array with children of type Hash in which at
|
|
536
579
|
least one of the Symbol keys `:food` and `:drink` (with any non-nil value type)
|
537
580
|
is present.
|
538
581
|
|
582
|
+
## Defaults
|
583
|
+
|
584
|
+
Starting from version 2.4.0, Schemacop allows you to define default values at
|
585
|
+
any point in your schema. If the validated data contains a nil value, it will be
|
586
|
+
substituted by the given default value.
|
587
|
+
|
588
|
+
Note that Schemacop never modifies the data you pass to it. If you want to
|
589
|
+
benefit from Schemacop-applied defaults, you need to access the cloned, modified
|
590
|
+
data returned by `validate` or `validate!`.
|
591
|
+
|
592
|
+
Applying defaults is done before validating the substructure and before any type
|
593
|
+
casting. The provided default will be validated same as user-supplied data, so
|
594
|
+
if your given default does not validate properly, a validation error is thrown.
|
595
|
+
Make sure your default values always match the underlying schema.
|
596
|
+
|
597
|
+
Defaults can be specified at any point:
|
598
|
+
|
599
|
+
|
600
|
+
```ruby
|
601
|
+
# Basic usage
|
602
|
+
Schema.new do
|
603
|
+
type :string, default: 'Hello World'
|
604
|
+
end
|
605
|
+
|
606
|
+
# The default given for the first type will match
|
607
|
+
Schema.new do
|
608
|
+
type :string, default: 'Hello World' # This will always be applied of no value is supplied
|
609
|
+
type :integer, default: 42
|
610
|
+
end
|
611
|
+
|
612
|
+
# You can also pass entire hashes or arrays to your defaults
|
613
|
+
Schema.new do
|
614
|
+
req :foo, :hash, default: { foo: :bar } do
|
615
|
+
req :foo, :symbol
|
616
|
+
end
|
617
|
+
req :bar, :array, :integer, default: [1, 2, 3]
|
618
|
+
end
|
619
|
+
|
620
|
+
# Defaults must match the given schema. The following will fail.
|
621
|
+
Schema.new do
|
622
|
+
req :foo, default: { bar: :baz } do
|
623
|
+
req :foo
|
624
|
+
end
|
625
|
+
end
|
626
|
+
```
|
627
|
+
|
628
|
+
### Required data points
|
629
|
+
|
630
|
+
Note that any *required* validation is done before applying the defaults. If you
|
631
|
+
specify a `req` field, it must always be given, no matter if you have specified
|
632
|
+
a default or not. Therefore, specifying `req` fields do not make sense in
|
633
|
+
conjunction with defaults, as the default is always ignored.
|
634
|
+
|
635
|
+
## Type casting
|
636
|
+
|
637
|
+
Starting from version 2.4.0, Schemacop allows you to specify type castings that
|
638
|
+
can alter the validated data. Consider the following:
|
639
|
+
|
640
|
+
```ruby
|
641
|
+
s = Schema.new do
|
642
|
+
req :id, :integer, cast: [String]
|
643
|
+
end
|
644
|
+
|
645
|
+
data = s.validate!(id: '42')
|
646
|
+
data # => { id: 42 }
|
647
|
+
```
|
648
|
+
|
649
|
+
Note that Schemacop never modifies the data you pass to it. If you want to
|
650
|
+
benefit from Schemacop-applied castings, you need to access the cloned, modified
|
651
|
+
data returned by `validate` or `validate!`.
|
652
|
+
|
653
|
+
### Specifying type castings
|
654
|
+
|
655
|
+
Type castings can be specified using two forms: Either as a hash or as an array.
|
656
|
+
While using an array only allows you to specify the supported source types to be
|
657
|
+
casted, using a hash allows you to specify custom casting logic as blocks.
|
658
|
+
|
659
|
+
For hashes, the key must be a class and the value must be either `:default` for
|
660
|
+
using a built-in caster or a callable object (proc or lambda) that receives the
|
661
|
+
value and is supposed to cast it. If the value can't be casted, the proc must
|
662
|
+
fail with an exception. The exception message will then be contained in the
|
663
|
+
collected validation errors.
|
664
|
+
|
665
|
+
Example:
|
666
|
+
|
667
|
+
```ruby
|
668
|
+
Schema.new do
|
669
|
+
# Pass array to `cast`. This enables casting from String or Float to Integer
|
670
|
+
# using the built-in casters.
|
671
|
+
req: id_1, :integer, cast: [String, Float]
|
672
|
+
|
673
|
+
# Pass hash to `cast`. This enables casting from Float to Integer using the
|
674
|
+
# built-in caster and from String to Integer using a custom callback.
|
675
|
+
req :id_2, :integer, cast: { Float => :default, String => proc { |s| Integer(s) }
|
676
|
+
end
|
677
|
+
```
|
678
|
+
|
679
|
+
### Built-in casters
|
680
|
+
|
681
|
+
Schemacop comes with the following casters:
|
682
|
+
|
683
|
+
- `String` to `Integer` and `Float`
|
684
|
+
- `Float` to `Integer`
|
685
|
+
- `Integer` to `Float`
|
686
|
+
|
687
|
+
Note that all built-in casters are precise, so the string `foo` will fail with
|
688
|
+
an error if casted to an Integer. When casting float values and strings
|
689
|
+
containing float values to integers, the decimal places will be discarded
|
690
|
+
however.
|
691
|
+
|
692
|
+
### Execution order
|
693
|
+
|
694
|
+
The casting is done *before* the options `if` and `check` are evaluated.
|
695
|
+
Example:
|
696
|
+
|
697
|
+
```ruby
|
698
|
+
s = Schema.new do
|
699
|
+
type :integer, if: proc { |i| i == 42 } # 1
|
700
|
+
type :integer, check: proc { |i| i < 3 } # 2
|
701
|
+
type :string
|
702
|
+
end
|
703
|
+
|
704
|
+
s.validate!('42') # 1 will match
|
705
|
+
s.validate!('2') # 2 will match
|
706
|
+
s.validate!('234') # 3 will match
|
707
|
+
s.validate!(5) # Will fail, as nothing matches
|
708
|
+
```
|
709
|
+
|
710
|
+
### Caveats
|
711
|
+
|
712
|
+
Casting only works with type definitions that only include one type. For
|
713
|
+
instance, the `Numeric` validator includes both `Integer` and `Float`, which
|
714
|
+
would made it unclear what to cast a string into:
|
715
|
+
|
716
|
+
```ruby
|
717
|
+
# This does not work, as it is unclear whether to cast the String into an
|
718
|
+
# Integer or a Float.
|
719
|
+
type :number, cast: [String]
|
720
|
+
```
|
721
|
+
|
722
|
+
The same also applies to booleans, as they compound both `TrueClass` and
|
723
|
+
`FalseClass`. This may be tackled in future releases.
|
724
|
+
|
539
725
|
## Exceptions
|
540
726
|
|
541
727
|
Schemacop will throw one of the following checked exceptions:
|
@@ -553,20 +739,24 @@ Schemacop will throw one of the following checked exceptions:
|
|
553
739
|
|
554
740
|
* Schemacop does not yet allow cyclic structures with infinite depth.
|
555
741
|
|
556
|
-
* Schemacop aborts when it encounters an error. It is not able to collect a full
|
557
|
-
list of multiple errors.
|
558
|
-
|
559
742
|
* Schemacop is not made for validating complex causalities (i.e. field `a`
|
560
743
|
needs to be given only if field `b` is present).
|
561
744
|
|
562
745
|
* Schemacop does not yet support string regex matching.
|
563
746
|
|
564
|
-
##
|
747
|
+
## Development
|
748
|
+
|
749
|
+
To run tests:
|
750
|
+
|
751
|
+
* Check out the source
|
752
|
+
|
753
|
+
* Run `bundle install`
|
754
|
+
|
755
|
+
* Run `bundle exec rake test` to run all tests
|
565
756
|
|
566
|
-
|
567
|
-
|
568
|
-
to [SubGit](http://www.subgit.com/) for their great open source licensing.
|
757
|
+
* Run `bundle exec rake test TEST=test/unit/some/file.rb` to run a single test
|
758
|
+
file
|
569
759
|
|
570
760
|
## Copyright
|
571
761
|
|
572
|
-
Copyright (c)
|
762
|
+
Copyright (c) 2019 Sitrox. See `LICENSE` for further details.
|
data/RUBY_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.
|
1
|
+
ruby-2.6.2-p47
|
data/Rakefile
CHANGED
@@ -14,19 +14,20 @@ task :gemspec do
|
|
14
14
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
15
15
|
spec.require_paths = ['lib']
|
16
16
|
|
17
|
+
# This lower bound for ActiveSupport is not necessarily true. Schemacop
|
18
|
+
# needs access to ActiveSupport::HashWithIndifferentAccess and expects
|
19
|
+
# behavior of that as in version 5 of ActiveSupport.
|
20
|
+
spec.add_dependency 'activesupport', '>= 4.0'
|
17
21
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
18
22
|
spec.add_development_dependency 'rake'
|
19
23
|
spec.add_development_dependency 'ci_reporter', '~> 2.0'
|
20
24
|
spec.add_development_dependency 'ci_reporter_minitest'
|
21
25
|
spec.add_development_dependency 'haml'
|
26
|
+
spec.add_development_dependency 'colorize'
|
22
27
|
spec.add_development_dependency 'yard'
|
23
28
|
spec.add_development_dependency 'rubocop', '0.35.1'
|
24
29
|
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', '< 6'
|
30
|
+
spec.add_development_dependency 'pry'
|
30
31
|
end
|
31
32
|
|
32
33
|
File.open('schemacop.gemspec', 'w') { |f| f.write(gemspec.to_ruby.strip) }
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.4.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/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/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,11 +93,38 @@
|
|
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>, <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/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>
|
100
100
|
|
101
|
+
|
102
|
+
<h2>
|
103
|
+
Constant Summary
|
104
|
+
<small><a href="#" class="constants_summary_toggle">collapse</a></small>
|
105
|
+
</h2>
|
106
|
+
|
107
|
+
<dl class="constants">
|
108
|
+
|
109
|
+
<dt id="DEFAULT_CASTERS-constant" class="">DEFAULT_CASTERS =
|
110
|
+
|
111
|
+
</dt>
|
112
|
+
<dd><pre class="code"><span class='lbrace'>{</span>
|
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>
|
116
|
+
<span class='rbrace'>}</span><span class='comma'>,</span>
|
117
|
+
<span class='const'>Float</span> <span class='op'>=></span> <span class='lbrace'>{</span>
|
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>
|
119
|
+
<span class='rbrace'>}</span><span class='comma'>,</span>
|
120
|
+
<span class='const'>Integer</span> <span class='op'>=></span> <span class='lbrace'>{</span>
|
121
|
+
<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_f'>f</span><span class='op'>|</span> <span class='const'>Float</span><span class='lparen'>(</span><span class='id identifier rubyid_f'>f</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
122
|
+
<span class='rbrace'>}</span>
|
123
|
+
<span class='rbrace'>}</span></pre></dd>
|
124
|
+
|
125
|
+
</dl>
|
126
|
+
|
127
|
+
|
101
128
|
|
102
129
|
|
103
130
|
|
@@ -109,9 +136,9 @@
|
|
109
136
|
</div>
|
110
137
|
|
111
138
|
<div id="footer">
|
112
|
-
Generated on
|
139
|
+
Generated on Tue Nov 5 11:16:27 2019 by
|
113
140
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
114
|
-
0.9.
|
141
|
+
0.9.20 (ruby-2.6.2).
|
115
142
|
</div>
|
116
143
|
|
117
144
|
</div>
|