schemacop 2.3.2 → 2.4.0

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.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -0
  3. data/README.md +190 -2
  4. data/RUBY_VERSION +1 -1
  5. data/Rakefile +6 -5
  6. data/VERSION +1 -1
  7. data/doc/Schemacop.html +30 -3
  8. data/doc/Schemacop/ArrayValidator.html +2 -2
  9. data/doc/Schemacop/BooleanValidator.html +1 -1
  10. data/doc/Schemacop/Caster.html +379 -0
  11. data/doc/Schemacop/Collector.html +178 -102
  12. data/doc/Schemacop/Exceptions.html +1 -1
  13. data/doc/Schemacop/Exceptions/InvalidSchemaError.html +1 -1
  14. data/doc/Schemacop/Exceptions/ValidationError.html +1 -1
  15. data/doc/Schemacop/FieldNode.html +17 -5
  16. data/doc/Schemacop/FloatValidator.html +1 -1
  17. data/doc/Schemacop/HashValidator.html +1 -1
  18. data/doc/Schemacop/IntegerValidator.html +1 -1
  19. data/doc/Schemacop/NilValidator.html +1 -1
  20. data/doc/Schemacop/Node.html +95 -83
  21. data/doc/Schemacop/NodeResolver.html +26 -10
  22. data/doc/Schemacop/NodeSupportingField.html +1 -1
  23. data/doc/Schemacop/NodeSupportingType.html +2 -4
  24. data/doc/Schemacop/NodeWithBlock.html +1 -1
  25. data/doc/Schemacop/NumberValidator.html +1 -1
  26. data/doc/Schemacop/ObjectValidator.html +1 -1
  27. data/doc/Schemacop/RootNode.html +1 -1
  28. data/doc/Schemacop/Schema.html +3 -3
  29. data/doc/Schemacop/StringValidator.html +1 -1
  30. data/doc/Schemacop/SymbolValidator.html +1 -1
  31. data/doc/ScopedEnv.html +1 -1
  32. data/doc/_index.html +8 -1
  33. data/doc/class_list.html +1 -1
  34. data/doc/file.README.html +184 -3
  35. data/doc/index.html +184 -3
  36. data/doc/method_list.html +93 -61
  37. data/doc/top-level-namespace.html +1 -1
  38. data/lib/schemacop.rb +14 -0
  39. data/lib/schemacop/caster.rb +38 -0
  40. data/lib/schemacop/collector.rb +34 -6
  41. data/lib/schemacop/field_node.rb +25 -3
  42. data/lib/schemacop/node.rb +10 -2
  43. data/lib/schemacop/node_resolver.rb +10 -2
  44. data/lib/schemacop/node_supporting_type.rb +21 -1
  45. data/lib/schemacop/schema.rb +2 -2
  46. data/lib/schemacop/validator/array_validator.rb +1 -1
  47. data/lib/schemacop/validator/float_validator.rb +1 -1
  48. data/lib/schemacop/validator/integer_validator.rb +1 -1
  49. data/schemacop.gemspec +14 -8
  50. data/test/casting_test.rb +90 -0
  51. data/test/custom_check_test.rb +14 -14
  52. data/test/custom_if_test.rb +12 -12
  53. data/test/defaults_test.rb +71 -0
  54. data/test/nil_dis_allow_test.rb +6 -6
  55. data/test/node_resolver_test.rb +26 -0
  56. data/test/short_forms_test.rb +73 -66
  57. data/test/test_helper.rb +7 -0
  58. data/test/types_test.rb +5 -5
  59. data/test/validator_array_test.rb +16 -16
  60. data/test/validator_boolean_test.rb +2 -2
  61. data/test/validator_float_test.rb +15 -15
  62. data/test/validator_hash_test.rb +5 -5
  63. data/test/validator_integer_test.rb +9 -9
  64. data/test/validator_nil_test.rb +1 -1
  65. data/test/validator_number_test.rb +19 -19
  66. data/test/validator_object_test.rb +18 -18
  67. data/test/validator_string_test.rb +12 -12
  68. data/test/validator_symbol_test.rb +2 -2
  69. metadata +42 -6
@@ -177,12 +177,38 @@ FalseClass).</p>
177
177
  <h3><code>validate</code> vs <code>validate!</code> vs <code>valid?</code></h3>
178
178
 
179
179
  <p>The method <code>validate</code> will return a <code>Collector</code> object that contains all
180
- validation errors (if any), whereas <code>validate!</code> will accumulate all violations
181
- and finally throw an exception describing them.</p>
180
+ validation errors (if any) as well as a deep copy of your data with applied
181
+ defaults and castings, whereas <code>validate!</code> will accumulate all violations
182
+ and finally throw an exception describing them or, if the validation was
183
+ successful, a deep-copy of your supplied data with defaults and castings
184
+ applied.</p>
182
185
 
183
186
  <p>For simply querying the validity of some data, use the methods <code>valid?</code> or
184
187
  <code>invalid?</code>.</p>
185
188
 
189
+ <p>Examples:</p>
190
+
191
+ <pre class="code ruby"><code class="ruby"><span class='comment'># validate! returns your modified data or throws a validation error
192
+ </span><span class='id identifier rubyid_s'>s</span> <span class='op'>=</span> <span class='const'>Schema</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>do</span>
193
+ <span class='id identifier rubyid_req'>req</span> <span class='symbol'>:foo</span><span class='comma'>,</span> <span class='label'>default:</span> <span class='int'>42</span>
194
+ <span class='kw'>end</span>
195
+ <span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_validate!'>validate!</span><span class='lparen'>(</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span> <span class='comment'># =&gt; { foo: 42 }
196
+ </span>
197
+ <span class='comment'># validate returns a collector
198
+ </span><span class='id identifier rubyid_s'>s</span> <span class='op'>=</span> <span class='const'>Schema</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>do</span>
199
+ <span class='id identifier rubyid_req'>req</span> <span class='symbol'>:foo</span><span class='comma'>,</span> <span class='label'>default:</span> <span class='int'>42</span>
200
+ <span class='kw'>end</span>
201
+
202
+ <span class='id identifier rubyid_collector'>collector</span> <span class='op'>=</span> <span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_validate'>validate</span><span class='lparen'>(</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
203
+ <span class='id identifier rubyid_collector'>collector</span><span class='period'>.</span><span class='id identifier rubyid_valid?'>valid?</span> <span class='comment'># true
204
+ </span><span class='id identifier rubyid_collector'>collector</span><span class='period'>.</span><span class='id identifier rubyid_data'>data</span> <span class='comment'># =&gt; { foo: 42 }
205
+ </span>
206
+ <span class='id identifier rubyid_collector'>collector</span> <span class='op'>=</span> <span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_validate'>validate</span><span class='lparen'>(</span><span class='lbrace'>{</span> <span class='label'>foo:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>invalid</span><span class='tstring_end'>&#39;</span></span> <span class='rbrace'>}</span><span class='rparen'>)</span>
207
+ <span class='id identifier rubyid_collector'>collector</span><span class='period'>.</span><span class='id identifier rubyid_valid?'>valid?</span> <span class='comment'># false
208
+ </span><span class='id identifier rubyid_collector'>collector</span><span class='period'>.</span><span class='id identifier rubyid_data'>data</span> <span class='comment'># =&gt; nil
209
+ </span><span class='id identifier rubyid_collector'>collector</span><span class='period'>.</span><span class='id identifier rubyid_exceptions'>exceptions</span> <span class='comment'># =&gt; Validation error
210
+ </span></code></pre>
211
+
186
212
  <h2>Schemacop&#39;s DSL</h2>
187
213
 
188
214
  <p>In this section, we will ignore <a href="#short-forms">short forms</a> and explicitly
@@ -540,6 +566,10 @@ write Field Lines in the schema instantiation:</p>
540
566
  <span class='kw'>end</span>
541
567
  </code></pre>
542
568
 
569
+ <p>Note that this does not allow you to specify any options for the hash itself.
570
+ You still need to specify <code>:hash</code> as a type if you want to pass any options to
571
+ the hash (i.e. a <code>default</code>).</p>
572
+
543
573
  <h3>Shortform for subtypes</h3>
544
574
 
545
575
  <p>In case of nested arrays, you can group all Type Lines to a single one.</p>
@@ -595,6 +625,145 @@ of type Array with children of type Array with children of type Hash in which at
595
625
  least one of the Symbol keys <code>:food</code> and <code>:drink</code> (with any non-nil value type)
596
626
  is present.</p>
597
627
 
628
+ <h2>Defaults</h2>
629
+
630
+ <p>Starting from version 2.4.0, Schemacop allows you to define default values at
631
+ any point in your schema. If the validated data contains a nil value, it will be
632
+ substituted by the given default value.</p>
633
+
634
+ <p>Note that Schemacop never modifies the data you pass to it. If you want to
635
+ benefit from Schemacop-applied defaults, you need to access the cloned, modified
636
+ data returned by <code>validate</code> or <code>validate!</code>.</p>
637
+
638
+ <p>Applying defaults is done before validating the substructure and before any type
639
+ casting. The provided default will be validated same as user-supplied data, so
640
+ if your given default does not validate properly, a validation error is thrown.
641
+ Make sure your default values always match the underlying schema.</p>
642
+
643
+ <p>Defaults can be specified at any point:</p>
644
+
645
+ <pre class="code ruby"><code class="ruby"><span class='comment'># Basic usage
646
+ </span><span class='const'>Schema</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>do</span>
647
+ <span class='id identifier rubyid_type'>type</span> <span class='symbol'>:string</span><span class='comma'>,</span> <span class='label'>default:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Hello World</span><span class='tstring_end'>&#39;</span></span>
648
+ <span class='kw'>end</span>
649
+
650
+ <span class='comment'># The default given for the first type will match
651
+ </span><span class='const'>Schema</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>do</span>
652
+ <span class='id identifier rubyid_type'>type</span> <span class='symbol'>:string</span><span class='comma'>,</span> <span class='label'>default:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Hello World</span><span class='tstring_end'>&#39;</span></span> <span class='comment'># This will always be applied of no value is supplied
653
+ </span> <span class='id identifier rubyid_type'>type</span> <span class='symbol'>:integer</span><span class='comma'>,</span> <span class='label'>default:</span> <span class='int'>42</span>
654
+ <span class='kw'>end</span>
655
+
656
+ <span class='comment'># You can also pass entire hashes or arrays to your defaults
657
+ </span><span class='const'>Schema</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>do</span>
658
+ <span class='id identifier rubyid_req'>req</span> <span class='symbol'>:foo</span><span class='comma'>,</span> <span class='symbol'>:hash</span><span class='comma'>,</span> <span class='label'>default:</span> <span class='lbrace'>{</span> <span class='label'>foo:</span> <span class='symbol'>:bar</span> <span class='rbrace'>}</span> <span class='kw'>do</span>
659
+ <span class='id identifier rubyid_req'>req</span> <span class='symbol'>:foo</span><span class='comma'>,</span> <span class='symbol'>:symbol</span>
660
+ <span class='kw'>end</span>
661
+ <span class='id identifier rubyid_req'>req</span> <span class='symbol'>:bar</span><span class='comma'>,</span> <span class='symbol'>:array</span><span class='comma'>,</span> <span class='symbol'>:integer</span><span class='comma'>,</span> <span class='label'>default:</span> <span class='lbracket'>[</span><span class='int'>1</span><span class='comma'>,</span> <span class='int'>2</span><span class='comma'>,</span> <span class='int'>3</span><span class='rbracket'>]</span>
662
+ <span class='kw'>end</span>
663
+
664
+ <span class='comment'># Defaults must match the given schema. The following will fail.
665
+ </span><span class='const'>Schema</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>do</span>
666
+ <span class='id identifier rubyid_req'>req</span> <span class='symbol'>:foo</span><span class='comma'>,</span> <span class='label'>default:</span> <span class='lbrace'>{</span> <span class='label'>bar:</span> <span class='symbol'>:baz</span> <span class='rbrace'>}</span> <span class='kw'>do</span>
667
+ <span class='id identifier rubyid_req'>req</span> <span class='symbol'>:foo</span>
668
+ <span class='kw'>end</span>
669
+ <span class='kw'>end</span>
670
+ </code></pre>
671
+
672
+ <h3>Required data points</h3>
673
+
674
+ <p>Note that any <em>required</em> validation is done before applying the defaults. If you
675
+ specify a <code>req</code> field, it must always be given, no matter if you have specified
676
+ a default or not. Therefore, specifying <code>req</code> fields do not make sense in
677
+ conjunction with defaults, as the default is always ignored.</p>
678
+
679
+ <h2>Type casting</h2>
680
+
681
+ <p>Starting from version 2.4.0, Schemacop allows you to specify type castings that
682
+ can alter the validated data. Consider the following:</p>
683
+
684
+ <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_s'>s</span> <span class='op'>=</span> <span class='const'>Schema</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>do</span>
685
+ <span class='id identifier rubyid_req'>req</span> <span class='symbol'>:id</span><span class='comma'>,</span> <span class='symbol'>:integer</span><span class='comma'>,</span> <span class='label'>cast:</span> <span class='lbracket'>[</span><span class='const'>String</span><span class='rbracket'>]</span>
686
+ <span class='kw'>end</span>
687
+
688
+ <span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_validate!'>validate!</span><span class='lparen'>(</span><span class='label'>id:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>42</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
689
+ <span class='id identifier rubyid_data'>data</span> <span class='comment'># =&gt; { id: 42 }
690
+ </span></code></pre>
691
+
692
+ <p>Note that Schemacop never modifies the data you pass to it. If you want to
693
+ benefit from Schemacop-applied castings, you need to access the cloned, modified
694
+ data returned by <code>validate</code> or <code>validate!</code>.</p>
695
+
696
+ <h3>Specifying type castings</h3>
697
+
698
+ <p>Type castings can be specified using two forms: Either as a hash or as an array.
699
+ While using an array only allows you to specify the supported source types to be
700
+ casted, using a hash allows you to specify custom casting logic as blocks.</p>
701
+
702
+ <p>For hashes, the key must be a class and the value must be either <code>:default</code> for
703
+ using a built-in caster or a callable object (proc or lambda) that receives the
704
+ value and is supposed to cast it. If the value can&#39;t be casted, the proc must
705
+ fail with an exception. The exception message will then be contained in the
706
+ collected validation errors.</p>
707
+
708
+ <p>Example:</p>
709
+
710
+ <pre class="code ruby"><code class="ruby">Schema.new do
711
+ # Pass array to `cast`. This enables casting from String or Float to Integer
712
+ # using the built-in casters.
713
+ req: id_1, :integer, cast: [String, Float]
714
+
715
+ # Pass hash to `cast`. This enables casting from Float to Integer using the
716
+ # built-in caster and from String to Integer using a custom callback.
717
+ req :id_2, :integer, cast: { Float =&gt; :default, String =&gt; proc { |s| Integer(s) }
718
+ end
719
+ </code></pre>
720
+
721
+ <h3>Built-in casters</h3>
722
+
723
+ <p>Schemacop comes with the following casters:</p>
724
+
725
+ <ul>
726
+ <li><code>String</code> to <code>Integer</code> and <code>Float</code></li>
727
+ <li><code>Float</code> to <code>Integer</code></li>
728
+ <li><code>Integer</code> to <code>Float</code></li>
729
+ </ul>
730
+
731
+ <p>Note that all built-in casters are precise, so the string <code>foo</code> will fail with
732
+ an error if casted to an Integer. When casting float values and strings
733
+ containing float values to integers, the decimal places will be discarded
734
+ however.</p>
735
+
736
+ <h3>Execution order</h3>
737
+
738
+ <p>The casting is done <em>before</em> the options <code>if</code> and <code>check</code> are evaluated.
739
+ Example:</p>
740
+
741
+ <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_s'>s</span> <span class='op'>=</span> <span class='const'>Schema</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>do</span>
742
+ <span class='id identifier rubyid_type'>type</span> <span class='symbol'>:integer</span><span class='comma'>,</span> <span class='label'>if:</span> <span class='id identifier rubyid_proc'>proc</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span> <span class='id identifier rubyid_i'>i</span> <span class='op'>==</span> <span class='int'>42</span> <span class='rbrace'>}</span> <span class='comment'># 1
743
+ </span> <span class='id identifier rubyid_type'>type</span> <span class='symbol'>:integer</span><span class='comma'>,</span> <span class='label'>check:</span> <span class='id identifier rubyid_proc'>proc</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span> <span class='id identifier rubyid_i'>i</span> <span class='op'>&lt;</span> <span class='int'>3</span> <span class='rbrace'>}</span> <span class='comment'># 2
744
+ </span> <span class='id identifier rubyid_type'>type</span> <span class='symbol'>:string</span>
745
+ <span class='kw'>end</span>
746
+
747
+ <span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_validate!'>validate!</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>42</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='comment'># 1 will match
748
+ </span><span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_validate!'>validate!</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>2</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='comment'># 2 will match
749
+ </span><span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_validate!'>validate!</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>234</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='comment'># 3 will match
750
+ </span><span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_validate!'>validate!</span><span class='lparen'>(</span><span class='int'>5</span><span class='rparen'>)</span> <span class='comment'># Will fail, as nothing matches
751
+ </span></code></pre>
752
+
753
+ <h3>Caveats</h3>
754
+
755
+ <p>Casting only works with type definitions that only include one type. For
756
+ instance, the <code>Numeric</code> validator includes both <code>Integer</code> and <code>Float</code>, which
757
+ would made it unclear what to cast a string into:</p>
758
+
759
+ <pre class="code ruby"><code class="ruby"><span class='comment'># This does not work, as it is unclear whether to cast the String into an
760
+ </span><span class='comment'># Integer or a Float.
761
+ </span><span class='id identifier rubyid_type'>type</span> <span class='symbol'>:number</span><span class='comma'>,</span> <span class='label'>cast:</span> <span class='lbracket'>[</span><span class='const'>String</span><span class='rbracket'>]</span>
762
+ </code></pre>
763
+
764
+ <p>The same also applies to booleans, as they compound both <code>TrueClass</code> and
765
+ <code>FalseClass</code>. This may be tackled in future releases.</p>
766
+
598
767
  <h2>Exceptions</h2>
599
768
 
600
769
  <p>Schemacop will throw one of the following checked exceptions:</p>
@@ -623,6 +792,18 @@ needs to be given only if field <code>b</code> is present).</p></li>
623
792
  <li><p>Schemacop does not yet support string regex matching.</p></li>
624
793
  </ul>
625
794
 
795
+ <h2>Development</h2>
796
+
797
+ <p>To run tests:</p>
798
+
799
+ <ul>
800
+ <li><p>Check out the source</p></li>
801
+ <li><p>Run <code>bundle install</code></p></li>
802
+ <li><p>Run <code>bundle exec rake test</code> to run all tests</p></li>
803
+ <li><p>Run <code>bundle exec rake test TEST=test/unit/some/file.rb</code> to run a single test
804
+ file</p></li>
805
+ </ul>
806
+
626
807
  <h2>Contributors</h2>
627
808
 
628
809
  <p>Thanks to <a href="https://github.com/bbatsov/rubocop">Rubocop</a> for great inspiration
@@ -635,7 +816,7 @@ to <a href="http://www.subgit.com/">SubGit</a> for their great open source licen
635
816
  </div></div>
636
817
 
637
818
  <div id="footer">
638
- Generated on Thu Sep 26 13:19:46 2019 by
819
+ Generated on Mon Oct 28 16:21:59 2019 by
639
820
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
640
821
  0.9.20 (ruby-2.6.2).
641
822
  </div>
@@ -68,6 +68,22 @@
68
68
  </li>
69
69
 
70
70
 
71
+ <li class="even ">
72
+ <div class="item">
73
+ <span class='object_link'><a href="Schemacop/Caster.html#cast-instance_method" title="Schemacop::Caster#cast (method)">#cast</a></span>
74
+ <small>Schemacop::Caster</small>
75
+ </div>
76
+ </li>
77
+
78
+
79
+ <li class="odd ">
80
+ <div class="item">
81
+ <span class='object_link'><a href="Schemacop/Caster.html#castable%3F-instance_method" title="Schemacop::Caster#castable? (method)">#castable?</a></span>
82
+ <small>Schemacop::Caster</small>
83
+ </div>
84
+ </li>
85
+
86
+
71
87
  <li class="even ">
72
88
  <div class="item">
73
89
  <span class='object_link'><a href="Schemacop/Node.html#class_matches%3F-class_method" title="Schemacop::Node.class_matches? (method)">class_matches?</a></span>
@@ -94,7 +110,7 @@
94
110
 
95
111
  <li class="odd ">
96
112
  <div class="item">
97
- <span class='object_link'><a href="Schemacop/Collector.html#current_path-instance_method" title="Schemacop::Collector#current_path (method)">#current_path</a></span>
113
+ <span class='object_link'><a href="Schemacop/Collector.html#data-instance_method" title="Schemacop::Collector#data (method)">#data</a></span>
98
114
  <small>Schemacop::Collector</small>
99
115
  </div>
100
116
  </li>
@@ -126,24 +142,24 @@
126
142
 
127
143
  <li class="odd ">
128
144
  <div class="item">
129
- <span class='object_link'><a href="Schemacop/NodeWithBlock.html#exec_block-instance_method" title="Schemacop::NodeWithBlock#exec_block (method)">#exec_block</a></span>
130
- <small>Schemacop::NodeWithBlock</small>
145
+ <span class='object_link'><a href="Schemacop/NodeSupportingType.html#exec_block-instance_method" title="Schemacop::NodeSupportingType#exec_block (method)">#exec_block</a></span>
146
+ <small>Schemacop::NodeSupportingType</small>
131
147
  </div>
132
148
  </li>
133
149
 
134
150
 
135
151
  <li class="even ">
136
152
  <div class="item">
137
- <span class='object_link'><a href="Schemacop/Node.html#exec_block-instance_method" title="Schemacop::Node#exec_block (method)">#exec_block</a></span>
138
- <small>Schemacop::Node</small>
153
+ <span class='object_link'><a href="Schemacop/NodeWithBlock.html#exec_block-instance_method" title="Schemacop::NodeWithBlock#exec_block (method)">#exec_block</a></span>
154
+ <small>Schemacop::NodeWithBlock</small>
139
155
  </div>
140
156
  </li>
141
157
 
142
158
 
143
159
  <li class="odd ">
144
160
  <div class="item">
145
- <span class='object_link'><a href="Schemacop/NodeSupportingType.html#exec_block-instance_method" title="Schemacop::NodeSupportingType#exec_block (method)">#exec_block</a></span>
146
- <small>Schemacop::NodeSupportingType</small>
161
+ <span class='object_link'><a href="Schemacop/Node.html#exec_block-instance_method" title="Schemacop::Node#exec_block (method)">#exec_block</a></span>
162
+ <small>Schemacop::Node</small>
147
163
  </div>
148
164
  </li>
149
165
 
@@ -166,77 +182,85 @@
166
182
 
167
183
  <li class="even ">
168
184
  <div class="item">
169
- <span class='object_link'><a href="Schemacop/Node.html#initialize-instance_method" title="Schemacop::Node#initialize (method)">#initialize</a></span>
170
- <small>Schemacop::Node</small>
185
+ <span class='object_link'><a href="Schemacop/Schema.html#initialize-instance_method" title="Schemacop::Schema#initialize (method)">#initialize</a></span>
186
+ <small>Schemacop::Schema</small>
171
187
  </div>
172
188
  </li>
173
189
 
174
190
 
175
191
  <li class="odd ">
176
192
  <div class="item">
177
- <span class='object_link'><a href="Schemacop/NodeSupportingField.html#initialize-instance_method" title="Schemacop::NodeSupportingField#initialize (method)">#initialize</a></span>
178
- <small>Schemacop::NodeSupportingField</small>
193
+ <span class='object_link'><a href="Schemacop/NodeSupportingType.html#initialize-instance_method" title="Schemacop::NodeSupportingType#initialize (method)">#initialize</a></span>
194
+ <small>Schemacop::NodeSupportingType</small>
179
195
  </div>
180
196
  </li>
181
197
 
182
198
 
183
199
  <li class="even ">
184
200
  <div class="item">
185
- <span class='object_link'><a href="Schemacop/Schema.html#initialize-instance_method" title="Schemacop::Schema#initialize (method)">#initialize</a></span>
186
- <small>Schemacop::Schema</small>
201
+ <span class='object_link'><a href="Schemacop/Node.html#initialize-instance_method" title="Schemacop::Node#initialize (method)">#initialize</a></span>
202
+ <small>Schemacop::Node</small>
187
203
  </div>
188
204
  </li>
189
205
 
190
206
 
191
207
  <li class="odd ">
192
208
  <div class="item">
193
- <span class='object_link'><a href="Schemacop/NodeSupportingType.html#initialize-instance_method" title="Schemacop::NodeSupportingType#initialize (method)">#initialize</a></span>
194
- <small>Schemacop::NodeSupportingType</small>
209
+ <span class='object_link'><a href="ScopedEnv.html#initialize-instance_method" title="ScopedEnv#initialize (method)">#initialize</a></span>
210
+ <small>ScopedEnv</small>
195
211
  </div>
196
212
  </li>
197
213
 
198
214
 
199
215
  <li class="even ">
200
216
  <div class="item">
201
- <span class='object_link'><a href="Schemacop/Collector.html#initialize-instance_method" title="Schemacop::Collector#initialize (method)">#initialize</a></span>
202
- <small>Schemacop::Collector</small>
217
+ <span class='object_link'><a href="Schemacop/FieldNode.html#initialize-instance_method" title="Schemacop::FieldNode#initialize (method)">#initialize</a></span>
218
+ <small>Schemacop::FieldNode</small>
203
219
  </div>
204
220
  </li>
205
221
 
206
222
 
207
223
  <li class="odd ">
208
224
  <div class="item">
209
- <span class='object_link'><a href="Schemacop/ArrayValidator.html#initialize-instance_method" title="Schemacop::ArrayValidator#initialize (method)">#initialize</a></span>
210
- <small>Schemacop::ArrayValidator</small>
225
+ <span class='object_link'><a href="Schemacop/Caster.html#initialize-instance_method" title="Schemacop::Caster#initialize (method)">#initialize</a></span>
226
+ <small>Schemacop::Caster</small>
211
227
  </div>
212
228
  </li>
213
229
 
214
230
 
215
231
  <li class="even ">
216
232
  <div class="item">
217
- <span class='object_link'><a href="Schemacop/StringValidator.html#initialize-instance_method" title="Schemacop::StringValidator#initialize (method)">#initialize</a></span>
218
- <small>Schemacop::StringValidator</small>
233
+ <span class='object_link'><a href="Schemacop/NodeSupportingField.html#initialize-instance_method" title="Schemacop::NodeSupportingField#initialize (method)">#initialize</a></span>
234
+ <small>Schemacop::NodeSupportingField</small>
219
235
  </div>
220
236
  </li>
221
237
 
222
238
 
223
239
  <li class="odd ">
224
240
  <div class="item">
225
- <span class='object_link'><a href="Schemacop/FieldNode.html#initialize-instance_method" title="Schemacop::FieldNode#initialize (method)">#initialize</a></span>
226
- <small>Schemacop::FieldNode</small>
241
+ <span class='object_link'><a href="Schemacop/ArrayValidator.html#initialize-instance_method" title="Schemacop::ArrayValidator#initialize (method)">#initialize</a></span>
242
+ <small>Schemacop::ArrayValidator</small>
227
243
  </div>
228
244
  </li>
229
245
 
230
246
 
231
247
  <li class="even ">
232
248
  <div class="item">
233
- <span class='object_link'><a href="ScopedEnv.html#initialize-instance_method" title="ScopedEnv#initialize (method)">#initialize</a></span>
234
- <small>ScopedEnv</small>
249
+ <span class='object_link'><a href="Schemacop/Collector.html#initialize-instance_method" title="Schemacop::Collector#initialize (method)">#initialize</a></span>
250
+ <small>Schemacop::Collector</small>
235
251
  </div>
236
252
  </li>
237
253
 
238
254
 
239
255
  <li class="odd ">
256
+ <div class="item">
257
+ <span class='object_link'><a href="Schemacop/StringValidator.html#initialize-instance_method" title="Schemacop::StringValidator#initialize (method)">#initialize</a></span>
258
+ <small>Schemacop::StringValidator</small>
259
+ </div>
260
+ </li>
261
+
262
+
263
+ <li class="even ">
240
264
  <div class="item">
241
265
  <span class='object_link'><a href="Schemacop/Schema.html#invalid%3F-instance_method" title="Schemacop::Schema#invalid? (method)">#invalid?</a></span>
242
266
  <small>Schemacop::Schema</small>
@@ -244,7 +268,7 @@
244
268
  </li>
245
269
 
246
270
 
247
- <li class="even ">
271
+ <li class="odd ">
248
272
  <div class="item">
249
273
  <span class='object_link'><a href="Schemacop/Node.html#klass-class_method" title="Schemacop::Node.klass (method)">klass</a></span>
250
274
  <small>Schemacop::Node</small>
@@ -252,7 +276,7 @@
252
276
  </li>
253
277
 
254
278
 
255
- <li class="odd ">
279
+ <li class="even ">
256
280
  <div class="item">
257
281
  <span class='object_link'><a href="ScopedEnv.html#method_missing-instance_method" title="ScopedEnv#method_missing (method)">#method_missing</a></span>
258
282
  <small>ScopedEnv</small>
@@ -260,7 +284,7 @@
260
284
  </li>
261
285
 
262
286
 
263
- <li class="even ">
287
+ <li class="odd ">
264
288
  <div class="item">
265
289
  <span class='object_link'><a href="Schemacop/FieldNode.html#name-instance_method" title="Schemacop::FieldNode#name (method)">#name</a></span>
266
290
  <small>Schemacop::FieldNode</small>
@@ -268,7 +292,7 @@
268
292
  </li>
269
293
 
270
294
 
271
- <li class="odd ">
295
+ <li class="even ">
272
296
  <div class="item">
273
297
  <span class='object_link'><a href="Schemacop/NodeSupportingField.html#opt!-instance_method" title="Schemacop::NodeSupportingField#opt! (method)">#opt!</a></span>
274
298
  <small>Schemacop::NodeSupportingField</small>
@@ -276,7 +300,7 @@
276
300
  </li>
277
301
 
278
302
 
279
- <li class="even ">
303
+ <li class="odd ">
280
304
  <div class="item">
281
305
  <span class='object_link'><a href="Schemacop/NodeSupportingField.html#opt%3F-instance_method" title="Schemacop::NodeSupportingField#opt? (method)">#opt?</a></span>
282
306
  <small>Schemacop::NodeSupportingField</small>
@@ -284,6 +308,14 @@
284
308
  </li>
285
309
 
286
310
 
311
+ <li class="even ">
312
+ <div class="item">
313
+ <span class='object_link'><a href="Schemacop/Node.html#option-class_method" title="Schemacop::Node.option (method)">option</a></span>
314
+ <small>Schemacop::Node</small>
315
+ </div>
316
+ </li>
317
+
318
+
287
319
  <li class="odd ">
288
320
  <div class="item">
289
321
  <span class='object_link'><a href="Schemacop/Node.html#option-instance_method" title="Schemacop::Node#option (method)">#option</a></span>
@@ -294,7 +326,7 @@
294
326
 
295
327
  <li class="even ">
296
328
  <div class="item">
297
- <span class='object_link'><a href="Schemacop/Node.html#option-class_method" title="Schemacop::Node.option (method)">option</a></span>
329
+ <span class='object_link'><a href="Schemacop/Node.html#option%3F-instance_method" title="Schemacop::Node#option? (method)">#option?</a></span>
298
330
  <small>Schemacop::Node</small>
299
331
  </div>
300
332
  </li>
@@ -302,7 +334,7 @@
302
334
 
303
335
  <li class="odd ">
304
336
  <div class="item">
305
- <span class='object_link'><a href="Schemacop/Node.html#option%3F-instance_method" title="Schemacop::Node#option? (method)">#option?</a></span>
337
+ <span class='object_link'><a href="Schemacop/Node.html#options-instance_method" title="Schemacop::Node#options (method)">#options</a></span>
306
338
  <small>Schemacop::Node</small>
307
339
  </div>
308
340
  </li>
@@ -310,8 +342,8 @@
310
342
 
311
343
  <li class="even ">
312
344
  <div class="item">
313
- <span class='object_link'><a href="Schemacop/Node.html#options-instance_method" title="Schemacop::Node#options (method)">#options</a></span>
314
- <small>Schemacop::Node</small>
345
+ <span class='object_link'><a href="Schemacop/Collector.html#override_value-instance_method" title="Schemacop::Collector#override_value (method)">#override_value</a></span>
346
+ <small>Schemacop::Collector</small>
315
347
  </div>
316
348
  </li>
317
349
 
@@ -326,16 +358,16 @@
326
358
 
327
359
  <li class="even ">
328
360
  <div class="item">
329
- <span class='object_link'><a href="Schemacop/Node.html#register-class_method" title="Schemacop::Node.register (method)">register</a></span>
330
- <small>Schemacop::Node</small>
361
+ <span class='object_link'><a href="Schemacop/NodeResolver.html#register-class_method" title="Schemacop::NodeResolver.register (method)">register</a></span>
362
+ <small>Schemacop::NodeResolver</small>
331
363
  </div>
332
364
  </li>
333
365
 
334
366
 
335
367
  <li class="odd ">
336
368
  <div class="item">
337
- <span class='object_link'><a href="Schemacop/NodeResolver.html#register-class_method" title="Schemacop::NodeResolver.register (method)">register</a></span>
338
- <small>Schemacop::NodeResolver</small>
369
+ <span class='object_link'><a href="Schemacop/Node.html#register-class_method" title="Schemacop::Node.register (method)">register</a></span>
370
+ <small>Schemacop::Node</small>
339
371
  </div>
340
372
  </li>
341
373
 
@@ -414,31 +446,31 @@
414
446
 
415
447
  <li class="odd ">
416
448
  <div class="item">
417
- <span class='object_link'><a href="Schemacop/ObjectValidator.html#type_label-instance_method" title="Schemacop::ObjectValidator#type_label (method)">#type_label</a></span>
418
- <small>Schemacop::ObjectValidator</small>
449
+ <span class='object_link'><a href="Schemacop/Node.html#type_label-instance_method" title="Schemacop::Node#type_label (method)">#type_label</a></span>
450
+ <small>Schemacop::Node</small>
419
451
  </div>
420
452
  </li>
421
453
 
422
454
 
423
455
  <li class="even ">
424
456
  <div class="item">
425
- <span class='object_link'><a href="Schemacop/Node.html#type_label-instance_method" title="Schemacop::Node#type_label (method)">#type_label</a></span>
426
- <small>Schemacop::Node</small>
457
+ <span class='object_link'><a href="Schemacop/ObjectValidator.html#type_label-instance_method" title="Schemacop::ObjectValidator#type_label (method)">#type_label</a></span>
458
+ <small>Schemacop::ObjectValidator</small>
427
459
  </div>
428
460
  </li>
429
461
 
430
462
 
431
463
  <li class="odd ">
432
464
  <div class="item">
433
- <span class='object_link'><a href="Schemacop/ObjectValidator.html#type_matches%3F-instance_method" title="Schemacop::ObjectValidator#type_matches? (method)">#type_matches?</a></span>
434
- <small>Schemacop::ObjectValidator</small>
465
+ <span class='object_link'><a href="Schemacop/Node.html#type_matches%3F-class_method" title="Schemacop::Node.type_matches? (method)">type_matches?</a></span>
466
+ <small>Schemacop::Node</small>
435
467
  </div>
436
468
  </li>
437
469
 
438
470
 
439
471
  <li class="even ">
440
472
  <div class="item">
441
- <span class='object_link'><a href="Schemacop/Node.html#type_matches%3F-class_method" title="Schemacop::Node.type_matches? (method)">type_matches?</a></span>
473
+ <span class='object_link'><a href="Schemacop/Node.html#type_matches%3F-instance_method" title="Schemacop::Node#type_matches? (method)">#type_matches?</a></span>
442
474
  <small>Schemacop::Node</small>
443
475
  </div>
444
476
  </li>
@@ -446,8 +478,8 @@
446
478
 
447
479
  <li class="odd ">
448
480
  <div class="item">
449
- <span class='object_link'><a href="Schemacop/Node.html#type_matches%3F-instance_method" title="Schemacop::Node#type_matches? (method)">#type_matches?</a></span>
450
- <small>Schemacop::Node</small>
481
+ <span class='object_link'><a href="Schemacop/ObjectValidator.html#type_matches%3F-instance_method" title="Schemacop::ObjectValidator#type_matches? (method)">#type_matches?</a></span>
482
+ <small>Schemacop::ObjectValidator</small>
451
483
  </div>
452
484
  </li>
453
485
 
@@ -470,8 +502,8 @@
470
502
 
471
503
  <li class="even ">
472
504
  <div class="item">
473
- <span class='object_link'><a href="Schemacop/StringValidator.html#validate-instance_method" title="Schemacop::StringValidator#validate (method)">#validate</a></span>
474
- <small>Schemacop::StringValidator</small>
505
+ <span class='object_link'><a href="Schemacop/HashValidator.html#validate-instance_method" title="Schemacop::HashValidator#validate (method)">#validate</a></span>
506
+ <small>Schemacop::HashValidator</small>
475
507
  </div>
476
508
  </li>
477
509
 
@@ -486,48 +518,48 @@
486
518
 
487
519
  <li class="even ">
488
520
  <div class="item">
489
- <span class='object_link'><a href="Schemacop/NodeSupportingType.html#validate-instance_method" title="Schemacop::NodeSupportingType#validate (method)">#validate</a></span>
490
- <small>Schemacop::NodeSupportingType</small>
521
+ <span class='object_link'><a href="Schemacop/ArrayValidator.html#validate-instance_method" title="Schemacop::ArrayValidator#validate (method)">#validate</a></span>
522
+ <small>Schemacop::ArrayValidator</small>
491
523
  </div>
492
524
  </li>
493
525
 
494
526
 
495
527
  <li class="odd ">
496
528
  <div class="item">
497
- <span class='object_link'><a href="Schemacop/Node.html#validate-instance_method" title="Schemacop::Node#validate (method)">#validate</a></span>
498
- <small>Schemacop::Node</small>
529
+ <span class='object_link'><a href="Schemacop/NumberValidator.html#validate-instance_method" title="Schemacop::NumberValidator#validate (method)">#validate</a></span>
530
+ <small>Schemacop::NumberValidator</small>
499
531
  </div>
500
532
  </li>
501
533
 
502
534
 
503
535
  <li class="even ">
504
536
  <div class="item">
505
- <span class='object_link'><a href="Schemacop/HashValidator.html#validate-instance_method" title="Schemacop::HashValidator#validate (method)">#validate</a></span>
506
- <small>Schemacop::HashValidator</small>
537
+ <span class='object_link'><a href="Schemacop/StringValidator.html#validate-instance_method" title="Schemacop::StringValidator#validate (method)">#validate</a></span>
538
+ <small>Schemacop::StringValidator</small>
507
539
  </div>
508
540
  </li>
509
541
 
510
542
 
511
543
  <li class="odd ">
512
544
  <div class="item">
513
- <span class='object_link'><a href="Schemacop/ArrayValidator.html#validate-instance_method" title="Schemacop::ArrayValidator#validate (method)">#validate</a></span>
514
- <small>Schemacop::ArrayValidator</small>
545
+ <span class='object_link'><a href="Schemacop/NodeSupportingType.html#validate-instance_method" title="Schemacop::NodeSupportingType#validate (method)">#validate</a></span>
546
+ <small>Schemacop::NodeSupportingType</small>
515
547
  </div>
516
548
  </li>
517
549
 
518
550
 
519
551
  <li class="even ">
520
552
  <div class="item">
521
- <span class='object_link'><a href="Schemacop/NumberValidator.html#validate-instance_method" title="Schemacop::NumberValidator#validate (method)">#validate</a></span>
522
- <small>Schemacop::NumberValidator</small>
553
+ <span class='object_link'><a href="Schemacop/FieldNode.html#validate-instance_method" title="Schemacop::FieldNode#validate (method)">#validate</a></span>
554
+ <small>Schemacop::FieldNode</small>
523
555
  </div>
524
556
  </li>
525
557
 
526
558
 
527
559
  <li class="odd ">
528
560
  <div class="item">
529
- <span class='object_link'><a href="Schemacop/FieldNode.html#validate-instance_method" title="Schemacop::FieldNode#validate (method)">#validate</a></span>
530
- <small>Schemacop::FieldNode</small>
561
+ <span class='object_link'><a href="Schemacop/Node.html#validate-instance_method" title="Schemacop::Node#validate (method)">#validate</a></span>
562
+ <small>Schemacop::Node</small>
531
563
  </div>
532
564
  </li>
533
565