kwalify 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +232 -0
- data/MIT-LICENSE +20 -0
- data/README.txt +16 -19
- data/bin/kwalify +3 -3
- data/contrib/inline-require +6 -4
- data/contrib/kwalify +3719 -2427
- data/doc-api/classes/CommandOptionError.html +17 -17
- data/doc-api/classes/CommandOptionParser.html +63 -63
- data/doc-api/classes/Kwalify.html +29 -7
- data/doc-api/classes/Kwalify/AssertionError.html +9 -9
- data/doc-api/classes/Kwalify/BaseError.html +72 -71
- data/doc-api/classes/Kwalify/BaseParser.html +461 -0
- data/doc-api/classes/Kwalify/CommandOptionError.html +11 -11
- data/doc-api/classes/Kwalify/ErrorHelper.html +51 -46
- data/doc-api/classes/Kwalify/HashInterface.html +13 -135
- data/doc-api/classes/Kwalify/Json.html +105 -0
- data/doc-api/classes/Kwalify/Main.html +129 -126
- data/doc-api/classes/Kwalify/MetaValidator.html +248 -232
- data/doc-api/classes/Kwalify/Parser.html +12 -12
- data/doc-api/classes/Kwalify/PlainYamlParser.html +166 -163
- data/doc-api/classes/Kwalify/PlainYamlParser/Alias.html +11 -11
- data/doc-api/classes/Kwalify/Rule.html +152 -130
- data/doc-api/classes/Kwalify/SchemaError.html +10 -10
- data/doc-api/classes/Kwalify/SyntaxError.html +185 -0
- data/doc-api/classes/Kwalify/Types.html +26 -25
- data/doc-api/classes/Kwalify/Util.html +389 -0
- data/doc-api/classes/Kwalify/Util/HashLike.html +246 -0
- data/doc-api/classes/Kwalify/Util/OrderedHash.html +330 -0
- data/doc-api/classes/Kwalify/ValidationError.html +10 -10
- data/doc-api/classes/Kwalify/Validator.html +153 -86
- data/doc-api/classes/Kwalify/Yaml.html +181 -0
- data/doc-api/classes/Kwalify/Yaml/Parser.html +1538 -0
- data/doc-api/classes/Kwalify/YamlParser.html +190 -183
- data/doc-api/classes/Kwalify/YamlSyntaxError.html +8 -57
- data/doc-api/created.rid +1 -1
- data/doc-api/files/__/README_txt.html +17 -22
- data/doc-api/files/kwalify/errors_rb.html +2 -2
- data/doc-api/files/kwalify/main_rb.html +4 -3
- data/doc-api/files/kwalify/messages_rb.html +2 -2
- data/doc-api/files/kwalify/meta-validator_rb.html +3 -3
- data/doc-api/files/kwalify/{util/yaml-helper_rb.html → parser/base_rb.html} +8 -6
- data/doc-api/files/kwalify/parser/yaml_rb.html +117 -0
- data/doc-api/files/kwalify/rule_rb.html +2 -2
- data/doc-api/files/kwalify/types_rb.html +2 -2
- data/doc-api/files/kwalify/util/assert-text-equal_rb.html +2 -2
- data/doc-api/files/kwalify/util/hash-interface_rb.html +9 -2
- data/doc-api/files/kwalify/util/hashlike_rb.html +107 -0
- data/doc-api/files/kwalify/util/option-parser_rb.html +2 -2
- data/doc-api/files/kwalify/util/ordered-hash_rb.html +107 -0
- data/doc-api/files/kwalify/util/testcase-helper_rb.html +2 -2
- data/doc-api/files/kwalify/util_rb.html +107 -0
- data/doc-api/files/kwalify/validator_rb.html +2 -2
- data/doc-api/files/kwalify/yaml-parser_rb.html +2 -2
- data/doc-api/files/kwalify_rb.html +3 -2
- data/doc-api/fr_class_index.html +8 -1
- data/doc-api/fr_file_index.html +5 -1
- data/doc-api/fr_method_index.html +128 -69
- data/doc/img/fig01.png +0 -0
- data/doc/users-guide.html +882 -717
- data/examples/address-book/address-book.schema.yaml +2 -2
- data/examples/data-binding/BABEL.data.yaml +63 -0
- data/examples/data-binding/BABEL.schema.yaml +31 -0
- data/examples/data-binding/Makefile +8 -0
- data/examples/data-binding/Rakefile +13 -0
- data/examples/data-binding/main.rb +27 -0
- data/examples/invoice/invoice.schema.yaml +3 -3
- data/examples/tapkit/tapkit.schema.yaml +2 -2
- data/lib/kwalify.rb +41 -4
- data/lib/kwalify/errors.rb +118 -96
- data/lib/kwalify/kwalify.schema.yaml +58 -0
- data/lib/kwalify/main.rb +384 -377
- data/lib/kwalify/messages.rb +41 -27
- data/lib/kwalify/meta-validator.rb +251 -331
- data/lib/kwalify/parser/base.rb +127 -0
- data/lib/kwalify/parser/yaml.rb +837 -0
- data/lib/kwalify/rule.rb +545 -487
- data/lib/kwalify/templates/genclass-java.eruby +189 -162
- data/lib/kwalify/templates/genclass-php.eruby +104 -0
- data/lib/kwalify/templates/genclass-ruby.eruby +95 -66
- data/lib/kwalify/types.rb +107 -106
- data/lib/kwalify/util.rb +157 -0
- data/lib/kwalify/util/assert-text-equal.rb +33 -31
- data/lib/kwalify/util/hash-interface.rb +11 -30
- data/lib/kwalify/util/hashlike.rb +51 -0
- data/lib/kwalify/util/option-parser.rb +144 -144
- data/lib/kwalify/util/ordered-hash.rb +57 -0
- data/lib/kwalify/util/testcase-helper.rb +3 -3
- data/lib/kwalify/validator.rb +267 -212
- data/lib/kwalify/yaml-parser.rb +822 -768
- data/setup.rb +861 -607
- data/test/Rookbook.yaml +10 -0
- data/test/{tmp.dir/Context.java → data/users-guide/AddressBook.java.expected} +11 -11
- data/test/data/users-guide/BABEL.data.yaml +24 -0
- data/test/data/users-guide/BABEL.schema.yaml +30 -0
- data/test/data/users-guide/ExampleAddressBook.java +47 -0
- data/test/{tmp.dir/Group.java → data/users-guide/Group.java.expected} +2 -11
- data/test/data/users-guide/Person.java.expected +44 -0
- data/test/data/users-guide/address_book.rb +52 -0
- data/test/data/users-guide/address_book.schema.yaml +28 -0
- data/test/data/users-guide/address_book.yaml +27 -0
- data/test/data/users-guide/answers-schema.yaml +12 -0
- data/test/data/users-guide/answers-validator.rb +52 -0
- data/test/data/users-guide/babel_genclass.result +26 -0
- data/test/data/users-guide/config.schema.yaml +7 -0
- data/test/data/users-guide/config.yaml +4 -0
- data/test/{tmp.dir/silent1.document → data/users-guide/document01a.yaml} +0 -0
- data/test/data/users-guide/document01b.yaml +3 -0
- data/test/data/users-guide/document02a.yaml +4 -0
- data/test/data/users-guide/document02b.yaml +4 -0
- data/test/data/users-guide/document03a.yaml +6 -0
- data/test/data/users-guide/document03b.yaml +6 -0
- data/test/data/users-guide/document04a.yaml +9 -0
- data/test/data/users-guide/document04b.yaml +9 -0
- data/test/data/users-guide/document05a.yaml +11 -0
- data/test/data/users-guide/document05b.yaml +12 -0
- data/test/data/users-guide/document06a.yaml +15 -0
- data/test/data/users-guide/document06b.yaml +16 -0
- data/test/data/users-guide/document07a.yaml +9 -0
- data/test/data/users-guide/document07b.yaml +7 -0
- data/test/data/users-guide/document12a.json +10 -0
- data/test/data/users-guide/document12b.json +6 -0
- data/test/data/users-guide/document13a.yaml +17 -0
- data/test/data/users-guide/document14a.yaml +3 -0
- data/test/data/users-guide/document14b.yaml +3 -0
- data/test/data/users-guide/document15a.yaml +6 -0
- data/test/data/users-guide/document15b.yaml +5 -0
- data/test/data/users-guide/example_address_book.rb +10 -0
- data/test/data/users-guide/example_address_book_java.result +32 -0
- data/test/data/users-guide/example_address_book_ruby.result +31 -0
- data/test/data/users-guide/genclass_java.result +4 -0
- data/test/data/users-guide/howto-validation-with-parsing.rb +28 -0
- data/test/data/users-guide/howto-validation.rb +25 -0
- data/test/data/users-guide/howto3.rb +6 -0
- data/test/data/users-guide/howto3.result +5 -0
- data/test/data/users-guide/howto3.yaml +8 -0
- data/test/data/users-guide/howto5_databinding.result +111 -0
- data/test/data/users-guide/invalid01.result +3 -0
- data/test/data/users-guide/invalid02.result +5 -0
- data/test/data/users-guide/invalid03.result +5 -0
- data/test/data/users-guide/invalid04.result +4 -0
- data/test/data/users-guide/invalid05.result +11 -0
- data/test/data/users-guide/invalid06.result +4 -0
- data/test/data/users-guide/invalid07.result +3 -0
- data/test/data/users-guide/invalid08.result +3 -0
- data/test/data/users-guide/invalid12.json +8 -0
- data/test/data/users-guide/invalid14.result +4 -0
- data/test/data/users-guide/invalid15.result +4 -0
- data/test/data/users-guide/loadbabel.rb +27 -0
- data/test/data/users-guide/loadconfig.rb +15 -0
- data/test/data/users-guide/loadconfig.result +2 -0
- data/test/data/users-guide/models.rb +22 -0
- data/test/data/users-guide/option_ha.result +6 -0
- data/test/data/users-guide/option_ha_genclass_java.result +7 -0
- data/test/{tmp.dir/meta1.schema → data/users-guide/schema01.yaml} +0 -0
- data/test/data/users-guide/schema02.yaml +12 -0
- data/test/data/users-guide/schema03.yaml +9 -0
- data/test/data/users-guide/schema04.yaml +20 -0
- data/test/data/users-guide/schema05.yaml +29 -0
- data/test/data/users-guide/schema06.yaml +11 -0
- data/test/data/users-guide/schema12.json +12 -0
- data/test/data/users-guide/schema13.yaml +13 -0
- data/test/data/users-guide/schema14.yaml +5 -0
- data/test/data/users-guide/schema15.yaml +21 -0
- data/test/data/users-guide/valid01.result +2 -0
- data/test/data/users-guide/valid02.result +2 -0
- data/test/data/users-guide/valid03.result +2 -0
- data/test/data/users-guide/valid04.result +2 -0
- data/test/data/users-guide/valid05.result +2 -0
- data/test/data/users-guide/valid06.result +2 -0
- data/test/data/users-guide/valid07.result +2 -0
- data/test/data/users-guide/valid08.result +2 -0
- data/test/data/users-guide/valid12.result +2 -0
- data/test/data/users-guide/valid13.result +2 -0
- data/test/data/users-guide/valid14.result +2 -0
- data/test/data/users-guide/valid15.result +2 -0
- data/test/data/users-guide/validate08.rb +37 -0
- data/test/test-action.rb +78 -0
- data/test/test-action.yaml +738 -0
- data/test/test-databinding.rb +80 -0
- data/test/test-databinding.yaml +301 -0
- data/test/test-main.rb +129 -150
- data/test/test-main.yaml +126 -321
- data/test/test-metavalidator.rb +47 -47
- data/test/test-metavalidator.yaml +77 -21
- data/test/test-parser-yaml.rb +57 -0
- data/test/test-parser-yaml.yaml +1749 -0
- data/test/test-rule.rb +14 -15
- data/test/test-rule.yaml +6 -3
- data/test/test-users-guide.rb +75 -0
- data/test/test-validator.rb +77 -52
- data/test/test-validator.yaml +168 -6
- data/test/test-yaml-parser.rb +47 -0
- data/test/{test-yamlparser.yaml → test-yaml-parser.yaml} +159 -52
- data/test/test.rb +37 -21
- metadata +136 -37
- data/COPYING +0 -340
- data/ChangeLog +0 -70
- data/doc-api/classes/YamlHelper.html +0 -259
- data/lib/kwalify/util/yaml-helper.rb +0 -82
- data/test/test-yamlparser.rb +0 -58
- data/test/tmp.dir/User.java +0 -43
- data/test/tmp.dir/action1.document +0 -18
- data/test/tmp.dir/action1.schema +0 -32
- data/test/tmp.dir/action2.document +0 -18
- data/test/tmp.dir/action2.schema +0 -32
- data/test/tmp.dir/emacs.document +0 -6
- data/test/tmp.dir/emacs.schema +0 -6
- data/test/tmp.dir/meta1.document +0 -0
- data/test/tmp.dir/meta2.document +0 -0
- data/test/tmp.dir/meta2.schema +0 -3
- data/test/tmp.dir/silent1.schema +0 -3
- data/test/tmp.dir/silent2.document +0 -7
- data/test/tmp.dir/silent2.schema +0 -3
- data/test/tmp.dir/stream.invalid +0 -8
- data/test/tmp.dir/stream.schema +0 -3
- data/test/tmp.dir/stream.valid +0 -8
- data/test/tmp.dir/untabify.document +0 -5
- data/test/tmp.dir/untabify.schema +0 -10
- data/todo.txt +0 -34
@@ -88,7 +88,7 @@
|
|
88
88
|
<h3 class="section-bar">Methods</h3>
|
89
89
|
|
90
90
|
<div class="name-list">
|
91
|
-
<a href="#
|
91
|
+
<a href="#M000125">new</a>
|
92
92
|
</div>
|
93
93
|
</div>
|
94
94
|
|
@@ -128,26 +128,26 @@
|
|
128
128
|
<div id="methods">
|
129
129
|
<h3 class="section-bar">Public Class methods</h3>
|
130
130
|
|
131
|
-
<div id="method-
|
132
|
-
<a name="
|
131
|
+
<div id="method-M000125" class="method-detail">
|
132
|
+
<a name="M000125"></a>
|
133
133
|
|
134
134
|
<div class="method-heading">
|
135
|
-
<a href="#
|
135
|
+
<a href="#M000125" class="method-signature">
|
136
136
|
<span class="method-name">new</span><span class="method-args">(message, option, error_symbol)</span>
|
137
137
|
</a>
|
138
138
|
</div>
|
139
139
|
|
140
140
|
<div class="method-description">
|
141
141
|
<p><a class="source-toggle" href="#"
|
142
|
-
onclick="toggleCode('
|
143
|
-
<div class="method-source-code" id="
|
142
|
+
onclick="toggleCode('M000125-source');return false;">[Source]</a></p>
|
143
|
+
<div class="method-source-code" id="M000125-source">
|
144
144
|
<pre>
|
145
145
|
<span class="ruby-comment cmt"># File kwalify/main.rb, line 18</span>
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
146
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">option</span>, <span class="ruby-identifier">error_symbol</span>)
|
147
|
+
<span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">message</span>)
|
148
|
+
<span class="ruby-ivar">@option</span> = <span class="ruby-identifier">option</span>
|
149
|
+
<span class="ruby-ivar">@error_symbol</span> = <span class="ruby-identifier">error_symbol</span>
|
150
|
+
<span class="ruby-keyword kw">end</span>
|
151
151
|
</pre>
|
152
152
|
</div>
|
153
153
|
</div>
|
@@ -80,10 +80,10 @@
|
|
80
80
|
<h3 class="section-bar">Methods</h3>
|
81
81
|
|
82
82
|
<div class="name-list">
|
83
|
-
<a href="#
|
84
|
-
<a href="#
|
85
|
-
<a href="#
|
86
|
-
<a href="#
|
83
|
+
<a href="#M000018">_build_message</a>
|
84
|
+
<a href="#M000015">assert_error</a>
|
85
|
+
<a href="#M000017">schema_error</a>
|
86
|
+
<a href="#M000016">validate_error</a>
|
87
87
|
</div>
|
88
88
|
</div>
|
89
89
|
|
@@ -105,99 +105,104 @@
|
|
105
105
|
<div id="methods">
|
106
106
|
<h3 class="section-bar">Public Instance methods</h3>
|
107
107
|
|
108
|
-
<div id="method-
|
109
|
-
<a name="
|
108
|
+
<div id="method-M000018" class="method-detail">
|
109
|
+
<a name="M000018"></a>
|
110
110
|
|
111
111
|
<div class="method-heading">
|
112
|
-
<a href="#
|
112
|
+
<a href="#M000018" class="method-signature">
|
113
113
|
<span class="method-name">_build_message</span><span class="method-args">(message_key, val, args)</span>
|
114
114
|
</a>
|
115
115
|
</div>
|
116
116
|
|
117
117
|
<div class="method-description">
|
118
118
|
<p><a class="source-toggle" href="#"
|
119
|
-
onclick="toggleCode('
|
120
|
-
<div class="method-source-code" id="
|
119
|
+
onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
|
120
|
+
<div class="method-source-code" id="M000018-source">
|
121
121
|
<pre>
|
122
|
-
<span class="ruby-comment cmt"># File kwalify/errors.rb, line
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
122
|
+
<span class="ruby-comment cmt"># File kwalify/errors.rb, line 114</span>
|
123
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_build_message</span>(<span class="ruby-identifier">message_key</span>, <span class="ruby-identifier">val</span>, <span class="ruby-identifier">args</span>)
|
124
|
+
<span class="ruby-identifier">msg</span> = <span class="ruby-constant">Kwalify</span>.<span class="ruby-identifier">msg</span>(<span class="ruby-identifier">message_key</span>)
|
125
|
+
<span class="ruby-identifier">assert_error</span>(<span class="ruby-node">"message_key=#{message_key.inspect}"</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">msg</span>
|
126
|
+
<span class="ruby-identifier">msg</span> = <span class="ruby-identifier">msg</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">args</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>
|
127
|
+
<span class="ruby-identifier">msg</span> = <span class="ruby-node">"'#{val.to_s.gsub(/\n/, '\n')}': #{msg}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">val</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">&&</span> <span class="ruby-constant">Types</span>.<span class="ruby-identifier">scalar?</span>(<span class="ruby-identifier">val</span>)
|
128
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">msg</span>;
|
129
|
+
<span class="ruby-keyword kw">end</span>
|
130
130
|
</pre>
|
131
131
|
</div>
|
132
132
|
</div>
|
133
133
|
</div>
|
134
134
|
|
135
|
-
<div id="method-
|
136
|
-
<a name="
|
135
|
+
<div id="method-M000015" class="method-detail">
|
136
|
+
<a name="M000015"></a>
|
137
137
|
|
138
138
|
<div class="method-heading">
|
139
|
-
<a href="#
|
139
|
+
<a href="#M000015" class="method-signature">
|
140
140
|
<span class="method-name">assert_error</span><span class="method-args">(message="")</span>
|
141
141
|
</a>
|
142
142
|
</div>
|
143
143
|
|
144
144
|
<div class="method-description">
|
145
|
+
<p>
|
146
|
+
module_function
|
147
|
+
</p>
|
145
148
|
<p><a class="source-toggle" href="#"
|
146
|
-
onclick="toggleCode('
|
147
|
-
<div class="method-source-code" id="
|
149
|
+
onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
|
150
|
+
<div class="method-source-code" id="M000015-source">
|
148
151
|
<pre>
|
149
|
-
<span class="ruby-comment cmt"># File kwalify/errors.rb, line
|
150
|
-
|
151
|
-
|
152
|
-
|
152
|
+
<span class="ruby-comment cmt"># File kwalify/errors.rb, line 97</span>
|
153
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_error</span>(<span class="ruby-identifier">message</span>=<span class="ruby-value str">""</span>)
|
154
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">AssertionError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">message</span>)
|
155
|
+
<span class="ruby-keyword kw">end</span>
|
153
156
|
</pre>
|
154
157
|
</div>
|
155
158
|
</div>
|
156
159
|
</div>
|
157
160
|
|
158
|
-
<div id="method-
|
159
|
-
<a name="
|
161
|
+
<div id="method-M000017" class="method-detail">
|
162
|
+
<a name="M000017"></a>
|
160
163
|
|
161
164
|
<div class="method-heading">
|
162
|
-
<a href="#
|
165
|
+
<a href="#M000017" class="method-signature">
|
163
166
|
<span class="method-name">schema_error</span><span class="method-args">(error_symbol, rule, path, val, args=nil)</span>
|
164
167
|
</a>
|
165
168
|
</div>
|
166
169
|
|
167
170
|
<div class="method-description">
|
168
171
|
<p><a class="source-toggle" href="#"
|
169
|
-
onclick="toggleCode('
|
170
|
-
<div class="method-source-code" id="
|
172
|
+
onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
|
173
|
+
<div class="method-source-code" id="M000017-source">
|
171
174
|
<pre>
|
172
|
-
<span class="ruby-comment cmt"># File kwalify/errors.rb, line
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
<span class="ruby-keyword kw">
|
175
|
+
<span class="ruby-comment cmt"># File kwalify/errors.rb, line 108</span>
|
176
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">schema_error</span>(<span class="ruby-identifier">error_symbol</span>, <span class="ruby-identifier">rule</span>, <span class="ruby-identifier">path</span>, <span class="ruby-identifier">val</span>, <span class="ruby-identifier">args</span>=<span class="ruby-keyword kw">nil</span>)
|
177
|
+
<span class="ruby-identifier">msg</span> = <span class="ruby-identifier">_build_message</span>(<span class="ruby-identifier">error_symbol</span>, <span class="ruby-identifier">val</span>, <span class="ruby-identifier">args</span>);
|
178
|
+
<span class="ruby-identifier">path</span> = <span class="ruby-value str">'/'</span><span class="ruby-operator">+</span><span class="ruby-identifier">path</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">'/'</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>)
|
179
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-constant">SchemaError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">msg</span>, <span class="ruby-identifier">path</span>, <span class="ruby-identifier">val</span>, <span class="ruby-identifier">rule</span>, <span class="ruby-identifier">error_symbol</span>)
|
180
|
+
<span class="ruby-keyword kw">end</span>
|
177
181
|
</pre>
|
178
182
|
</div>
|
179
183
|
</div>
|
180
184
|
</div>
|
181
185
|
|
182
|
-
<div id="method-
|
183
|
-
<a name="
|
186
|
+
<div id="method-M000016" class="method-detail">
|
187
|
+
<a name="M000016"></a>
|
184
188
|
|
185
189
|
<div class="method-heading">
|
186
|
-
<a href="#
|
190
|
+
<a href="#M000016" class="method-signature">
|
187
191
|
<span class="method-name">validate_error</span><span class="method-args">(error_symbol, rule, path, val, args=nil)</span>
|
188
192
|
</a>
|
189
193
|
</div>
|
190
194
|
|
191
195
|
<div class="method-description">
|
192
196
|
<p><a class="source-toggle" href="#"
|
193
|
-
onclick="toggleCode('
|
194
|
-
<div class="method-source-code" id="
|
197
|
+
onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
|
198
|
+
<div class="method-source-code" id="M000016-source">
|
195
199
|
<pre>
|
196
|
-
<span class="ruby-comment cmt"># File kwalify/errors.rb, line
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
<span class="ruby-keyword kw">
|
200
|
+
<span class="ruby-comment cmt"># File kwalify/errors.rb, line 101</span>
|
201
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">validate_error</span>(<span class="ruby-identifier">error_symbol</span>, <span class="ruby-identifier">rule</span>, <span class="ruby-identifier">path</span>, <span class="ruby-identifier">val</span>, <span class="ruby-identifier">args</span>=<span class="ruby-keyword kw">nil</span>)
|
202
|
+
<span class="ruby-identifier">msg</span> = <span class="ruby-identifier">_build_message</span>(<span class="ruby-identifier">error_symbol</span>, <span class="ruby-identifier">val</span>, <span class="ruby-identifier">args</span>);
|
203
|
+
<span class="ruby-identifier">path</span> = <span class="ruby-value str">'/'</span><span class="ruby-operator">+</span><span class="ruby-identifier">path</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">'/'</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>)
|
204
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-constant">ValidationError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">msg</span>, <span class="ruby-identifier">path</span>, <span class="ruby-identifier">val</span>, <span class="ruby-identifier">rule</span>, <span class="ruby-identifier">error_symbol</span>)
|
205
|
+
<span class="ruby-keyword kw">end</span>
|
201
206
|
</pre>
|
202
207
|
</div>
|
203
208
|
</div>
|
@@ -72,161 +72,39 @@
|
|
72
72
|
|
73
73
|
<div id="contextContent">
|
74
74
|
|
75
|
+
<div id="description">
|
76
|
+
<p>
|
77
|
+
OBSOLETE: use Hash::Util::HashLike instead.
|
78
|
+
</p>
|
75
79
|
|
80
|
+
</div>
|
76
81
|
|
77
|
-
</div>
|
78
82
|
|
79
|
-
|
80
|
-
<h3 class="section-bar">Methods</h3>
|
83
|
+
</div>
|
81
84
|
|
82
|
-
<div class="name-list">
|
83
|
-
<a href="#M000015">[]</a>
|
84
|
-
<a href="#M000016">[]=</a>
|
85
|
-
<a href="#M000019">each</a>
|
86
|
-
<a href="#M000018">key?</a>
|
87
|
-
<a href="#M000017">keys</a>
|
88
|
-
</div>
|
89
|
-
</div>
|
90
85
|
|
91
86
|
</div>
|
92
87
|
|
93
88
|
|
94
89
|
<!-- if includes -->
|
90
|
+
<div id="includes">
|
91
|
+
<h3 class="section-bar">Included Modules</h3>
|
95
92
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
<!-- if method_list -->
|
106
|
-
<div id="methods">
|
107
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
108
|
-
|
109
|
-
<div id="method-M000015" class="method-detail">
|
110
|
-
<a name="M000015"></a>
|
111
|
-
|
112
|
-
<div class="method-heading">
|
113
|
-
<a href="#M000015" class="method-signature">
|
114
|
-
<span class="method-name">[]</span><span class="method-args">(key)</span>
|
115
|
-
</a>
|
116
|
-
</div>
|
117
|
-
|
118
|
-
<div class="method-description">
|
119
|
-
<p><a class="source-toggle" href="#"
|
120
|
-
onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
|
121
|
-
<div class="method-source-code" id="M000015-source">
|
122
|
-
<pre>
|
123
|
-
<span class="ruby-comment cmt"># File kwalify/util/hash-interface.rb, line 11</span>
|
124
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-identifier">key</span>)
|
125
|
-
<span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-value str">"@{key}"</span>)
|
126
|
-
<span class="ruby-keyword kw">end</span>
|
127
|
-
</pre>
|
128
|
-
</div>
|
129
|
-
</div>
|
93
|
+
<div id="includes-list">
|
94
|
+
<span class="include-name"><a href="Util/HashLike.html">Kwalify::Util::HashLike</a></span>
|
130
95
|
</div>
|
96
|
+
</div>
|
131
97
|
|
132
|
-
|
133
|
-
<a name="M000016"></a>
|
98
|
+
<div id="section">
|
134
99
|
|
135
|
-
<div class="method-heading">
|
136
|
-
<a href="#M000016" class="method-signature">
|
137
|
-
<span class="method-name">[]=</span><span class="method-args">(key, val)</span>
|
138
|
-
</a>
|
139
|
-
</div>
|
140
|
-
|
141
|
-
<div class="method-description">
|
142
|
-
<p><a class="source-toggle" href="#"
|
143
|
-
onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
|
144
|
-
<div class="method-source-code" id="M000016-source">
|
145
|
-
<pre>
|
146
|
-
<span class="ruby-comment cmt"># File kwalify/util/hash-interface.rb, line 15</span>
|
147
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]=</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">val</span>)
|
148
|
-
<span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-value str">"@{key}"</span>, <span class="ruby-identifier">val</span>)
|
149
|
-
<span class="ruby-keyword kw">end</span>
|
150
|
-
</pre>
|
151
|
-
</div>
|
152
|
-
</div>
|
153
|
-
</div>
|
154
100
|
|
155
|
-
<div id="method-M000019" class="method-detail">
|
156
|
-
<a name="M000019"></a>
|
157
101
|
|
158
|
-
<div class="method-heading">
|
159
|
-
<a href="#M000019" class="method-signature">
|
160
|
-
<span class="method-name">each</span><span class="method-args">() {|key, val| ...}</span>
|
161
|
-
</a>
|
162
|
-
</div>
|
163
|
-
|
164
|
-
<div class="method-description">
|
165
|
-
<p><a class="source-toggle" href="#"
|
166
|
-
onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
|
167
|
-
<div class="method-source-code" id="M000019-source">
|
168
|
-
<pre>
|
169
|
-
<span class="ruby-comment cmt"># File kwalify/util/hash-interface.rb, line 27</span>
|
170
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each</span>
|
171
|
-
<span class="ruby-identifier">instance_variables</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span>
|
172
|
-
<span class="ruby-identifier">key</span> = <span class="ruby-identifier">name</span>[<span class="ruby-value">1</span>, <span class="ruby-identifier">name</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>]
|
173
|
-
<span class="ruby-identifier">val</span> = <span class="ruby-identifier">instance_varaible_get</span>(<span class="ruby-identifier">name</span>)
|
174
|
-
<span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">val</span>)
|
175
|
-
<span class="ruby-keyword kw">end</span>
|
176
|
-
<span class="ruby-keyword kw">end</span>
|
177
|
-
</pre>
|
178
|
-
</div>
|
179
|
-
</div>
|
180
|
-
</div>
|
181
102
|
|
182
|
-
<div id="method-M000018" class="method-detail">
|
183
|
-
<a name="M000018"></a>
|
184
103
|
|
185
|
-
<div class="method-heading">
|
186
|
-
<a href="#M000018" class="method-signature">
|
187
|
-
<span class="method-name">key?</span><span class="method-args">(key)</span>
|
188
|
-
</a>
|
189
|
-
</div>
|
190
104
|
|
191
|
-
<div class="method-description">
|
192
|
-
<p><a class="source-toggle" href="#"
|
193
|
-
onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
|
194
|
-
<div class="method-source-code" id="M000018-source">
|
195
|
-
<pre>
|
196
|
-
<span class="ruby-comment cmt"># File kwalify/util/hash-interface.rb, line 23</span>
|
197
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">key?</span>(<span class="ruby-identifier">key</span>)
|
198
|
-
<span class="ruby-identifier">instance_variables</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-node">"@#{key}"</span>)
|
199
|
-
<span class="ruby-keyword kw">end</span>
|
200
|
-
</pre>
|
201
|
-
</div>
|
202
|
-
</div>
|
203
|
-
</div>
|
204
|
-
|
205
|
-
<div id="method-M000017" class="method-detail">
|
206
|
-
<a name="M000017"></a>
|
207
105
|
|
208
|
-
<div class="method-heading">
|
209
|
-
<a href="#M000017" class="method-signature">
|
210
|
-
<span class="method-name">keys</span><span class="method-args">()</span>
|
211
|
-
</a>
|
212
|
-
</div>
|
213
|
-
|
214
|
-
<div class="method-description">
|
215
|
-
<p><a class="source-toggle" href="#"
|
216
|
-
onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
|
217
|
-
<div class="method-source-code" id="M000017-source">
|
218
|
-
<pre>
|
219
|
-
<span class="ruby-comment cmt"># File kwalify/util/hash-interface.rb, line 19</span>
|
220
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">keys</span>()
|
221
|
-
<span class="ruby-identifier">instance_variables</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span> <span class="ruby-identifier">name</span>[<span class="ruby-value">1</span>, <span class="ruby-identifier">name</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>] }
|
222
|
-
<span class="ruby-keyword kw">end</span>
|
223
|
-
</pre>
|
224
|
-
</div>
|
225
|
-
</div>
|
226
|
-
</div>
|
227
106
|
|
228
|
-
|
229
|
-
</div>
|
107
|
+
<!-- if method_list -->
|
230
108
|
|
231
109
|
|
232
110
|
</div>
|
@@ -0,0 +1,105 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: Kwalify::Json</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">Kwalify::Json</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/kwalify_rb.html">
|
59
|
+
kwalify.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
</div>
|
78
|
+
|
79
|
+
|
80
|
+
</div>
|
81
|
+
|
82
|
+
|
83
|
+
<!-- if includes -->
|
84
|
+
|
85
|
+
<div id="section">
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
<!-- if method_list -->
|
95
|
+
|
96
|
+
|
97
|
+
</div>
|
98
|
+
|
99
|
+
|
100
|
+
<div id="validator-badges">
|
101
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
102
|
+
</div>
|
103
|
+
|
104
|
+
</body>
|
105
|
+
</html>
|