kwalify 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. data/ChangeLog +24 -19
  2. data/README.txt +51 -51
  3. data/bin/kwalify +2 -2
  4. data/contrib/inline-require +151 -0
  5. data/contrib/kwalify +2850 -0
  6. data/doc-api/classes/CommandOptionError.html +184 -0
  7. data/doc-api/classes/CommandOptionParser.html +325 -0
  8. data/doc-api/classes/Kwalify.html +270 -0
  9. data/doc-api/classes/Kwalify/AssertionError.html +148 -0
  10. data/doc-api/classes/Kwalify/BaseError.html +296 -0
  11. data/doc-api/classes/Kwalify/CommandOptionError.html +168 -0
  12. data/doc-api/classes/Kwalify/ErrorHelper.html +218 -0
  13. data/doc-api/classes/Kwalify/HashInterface.html +240 -0
  14. data/doc-api/classes/Kwalify/KwalifyError.html +111 -0
  15. data/doc-api/classes/Kwalify/Main.html +336 -0
  16. data/doc-api/classes/Kwalify/MetaValidator.html +432 -0
  17. data/doc-api/classes/Kwalify/Parser.html +155 -0
  18. data/doc-api/classes/Kwalify/PlainYamlParser.html +520 -0
  19. data/doc-api/classes/Kwalify/PlainYamlParser/Alias.html +165 -0
  20. data/doc-api/classes/Kwalify/Rule.html +411 -0
  21. data/doc-api/classes/Kwalify/SchemaError.html +148 -0
  22. data/doc-api/classes/Kwalify/Types.html +301 -0
  23. data/doc-api/classes/Kwalify/ValidationError.html +148 -0
  24. data/doc-api/classes/Kwalify/Validator.html +311 -0
  25. data/doc-api/classes/Kwalify/YamlParser.html +535 -0
  26. data/doc-api/classes/Kwalify/YamlSyntaxError.html +168 -0
  27. data/doc-api/classes/Test.html +107 -0
  28. data/doc-api/classes/Test/Unit.html +101 -0
  29. data/doc-api/classes/YamlHelper.html +259 -0
  30. data/doc-api/created.rid +1 -0
  31. data/doc-api/files/__/README_txt.html +179 -0
  32. data/doc-api/files/kwalify/errors_rb.html +114 -0
  33. data/doc-api/files/kwalify/main_rb.html +117 -0
  34. data/doc-api/files/kwalify/messages_rb.html +107 -0
  35. data/doc-api/files/kwalify/meta-validator_rb.html +117 -0
  36. data/doc-api/files/kwalify/rule_rb.html +116 -0
  37. data/doc-api/files/kwalify/types_rb.html +114 -0
  38. data/doc-api/files/kwalify/util/assert-text-equal_rb.html +115 -0
  39. data/doc-api/files/kwalify/util/hash-interface_rb.html +107 -0
  40. data/doc-api/files/kwalify/util/option-parser_rb.html +107 -0
  41. data/doc-api/files/kwalify/util/testcase-helper_rb.html +115 -0
  42. data/doc-api/files/kwalify/util/yaml-helper_rb.html +114 -0
  43. data/doc-api/files/kwalify/validator_rb.html +117 -0
  44. data/doc-api/files/kwalify/yaml-parser_rb.html +117 -0
  45. data/doc-api/files/kwalify_rb.html +120 -0
  46. data/doc-api/fr_class_index.html +50 -0
  47. data/doc-api/fr_file_index.html +41 -0
  48. data/doc-api/fr_method_index.html +109 -0
  49. data/doc-api/index.html +24 -0
  50. data/doc-api/rdoc-style.css +208 -0
  51. data/doc/users-guide.html +693 -193
  52. data/examples/address-book/Makefile +5 -0
  53. data/examples/address-book/address-book.schema.yaml +2 -1
  54. data/examples/invoice/Makefile +5 -0
  55. data/examples/invoice/invoice.schema.yaml +3 -2
  56. data/examples/tapkit/Makefile +5 -0
  57. data/examples/tapkit/main.rb +7 -0
  58. data/examples/tapkit/tapkit.schema.yaml +6 -1
  59. data/lib/kwalify.rb +3 -3
  60. data/lib/kwalify/errors.rb +2 -2
  61. data/lib/kwalify/main.rb +161 -84
  62. data/lib/kwalify/messages.rb +17 -11
  63. data/lib/kwalify/meta-validator.rb +11 -2
  64. data/lib/kwalify/rule.rb +13 -3
  65. data/lib/kwalify/templates/genclass-java.eruby +195 -0
  66. data/lib/kwalify/templates/genclass-ruby.eruby +84 -0
  67. data/lib/kwalify/types.rb +18 -18
  68. data/lib/kwalify/util/assert-text-equal.rb +44 -0
  69. data/lib/kwalify/util/hash-interface.rb +37 -0
  70. data/lib/kwalify/util/option-parser.rb +2 -2
  71. data/lib/kwalify/util/testcase-helper.rb +112 -0
  72. data/lib/kwalify/util/yaml-helper.rb +2 -2
  73. data/lib/kwalify/validator.rb +2 -2
  74. data/lib/kwalify/yaml-parser.rb +12 -9
  75. data/test/test-main.rb +77 -78
  76. data/test/test-main.yaml +543 -769
  77. data/test/test-metavalidator.rb +27 -47
  78. data/test/test-metavalidator.yaml +21 -2
  79. data/test/test-rule.rb +6 -39
  80. data/test/test-rule.yaml +2 -2
  81. data/test/test-validator.rb +36 -869
  82. data/test/test-validator.yaml +28 -20
  83. data/test/test-yamlparser.rb +30 -1248
  84. data/test/test-yamlparser.yaml +138 -110
  85. data/test/test.rb +33 -13
  86. data/test/tmp.dir/Context.java +40 -0
  87. data/test/tmp.dir/Group.java +33 -0
  88. data/test/tmp.dir/User.java +43 -0
  89. data/test/tmp.dir/action1.document +18 -0
  90. data/test/tmp.dir/action1.schema +32 -0
  91. data/test/tmp.dir/action2.document +18 -0
  92. data/test/tmp.dir/action2.schema +32 -0
  93. data/test/tmp.dir/emacs.document +6 -0
  94. data/test/tmp.dir/emacs.schema +6 -0
  95. data/test/tmp.dir/meta1.document +0 -0
  96. data/test/tmp.dir/meta1.schema +3 -0
  97. data/test/tmp.dir/meta2.document +0 -0
  98. data/test/tmp.dir/meta2.schema +3 -0
  99. data/test/tmp.dir/silent1.document +3 -0
  100. data/test/tmp.dir/silent1.schema +3 -0
  101. data/test/tmp.dir/silent2.document +7 -0
  102. data/test/tmp.dir/silent2.schema +3 -0
  103. data/test/tmp.dir/stream.invalid +8 -0
  104. data/test/tmp.dir/stream.schema +3 -0
  105. data/test/tmp.dir/stream.valid +8 -0
  106. data/test/tmp.dir/untabify.document +5 -0
  107. data/test/tmp.dir/untabify.schema +10 -0
  108. metadata +98 -12
  109. data/lib/kwalify/util/assert-diff.rb +0 -44
@@ -0,0 +1,165 @@
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>Class: Kwalify::PlainYamlParser::Alias</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>Class</strong></td>
53
+ <td class="class-name-in-header">Kwalify::PlainYamlParser::Alias</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../../files/kwalify/yaml-parser_rb.html">
59
+ kwalify/yaml-parser.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Object
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+
82
+
83
+ </div>
84
+
85
+ <div id="method-list">
86
+ <h3 class="section-bar">Methods</h3>
87
+
88
+ <div class="name-list">
89
+ <a href="#M000080">new</a>&nbsp;&nbsp;
90
+ </div>
91
+ </div>
92
+
93
+ </div>
94
+
95
+
96
+ <!-- if includes -->
97
+
98
+ <div id="section">
99
+
100
+
101
+
102
+
103
+
104
+ <div id="attribute-list">
105
+ <h3 class="section-bar">Attributes</h3>
106
+
107
+ <div class="name-list">
108
+ <table>
109
+ <tr class="top-aligned-row context-row">
110
+ <td class="context-item-name">label</td>
111
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
112
+ <td class="context-item-desc"></td>
113
+ </tr>
114
+ <tr class="top-aligned-row context-row">
115
+ <td class="context-item-name">linenum</td>
116
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
117
+ <td class="context-item-desc"></td>
118
+ </tr>
119
+ </table>
120
+ </div>
121
+ </div>
122
+
123
+
124
+
125
+ <!-- if method_list -->
126
+ <div id="methods">
127
+ <h3 class="section-bar">Public Class methods</h3>
128
+
129
+ <div id="method-M000080" class="method-detail">
130
+ <a name="M000080"></a>
131
+
132
+ <div class="method-heading">
133
+ <a href="#M000080" class="method-signature">
134
+ <span class="method-name">new</span><span class="method-args">(label, linenum)</span>
135
+ </a>
136
+ </div>
137
+
138
+ <div class="method-description">
139
+ <p><a class="source-toggle" href="#"
140
+ onclick="toggleCode('M000080-source');return false;">[Source]</a></p>
141
+ <div class="method-source-code" id="M000080-source">
142
+ <pre>
143
+ <span class="ruby-comment cmt"># File kwalify/yaml-parser.rb, line 26</span>
144
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">label</span>, <span class="ruby-identifier">linenum</span>)
145
+ <span class="ruby-ivar">@label</span> = <span class="ruby-identifier">label</span>
146
+ <span class="ruby-ivar">@linenum</span> = <span class="ruby-identifier">linenum</span>
147
+ <span class="ruby-keyword kw">end</span>
148
+ </pre>
149
+ </div>
150
+ </div>
151
+ </div>
152
+
153
+
154
+ </div>
155
+
156
+
157
+ </div>
158
+
159
+
160
+ <div id="validator-badges">
161
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
162
+ </div>
163
+
164
+ </body>
165
+ </html>
@@ -0,0 +1,411 @@
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>Class: Kwalify::Rule</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>Class</strong></td>
53
+ <td class="class-name-in-header">Kwalify::Rule</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/kwalify/rule_rb.html">
59
+ kwalify/rule.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Object
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+
82
+
83
+ </div>
84
+
85
+ <div id="method-list">
86
+ <h3 class="section-bar">Methods</h3>
87
+
88
+ <div class="name-list">
89
+ <a href="#M000058">_inspect</a>&nbsp;&nbsp;
90
+ <a href="#M000057">init</a>&nbsp;&nbsp;
91
+ <a href="#M000056">new</a>&nbsp;&nbsp;
92
+ </div>
93
+ </div>
94
+
95
+ </div>
96
+
97
+
98
+ <!-- if includes -->
99
+ <div id="includes">
100
+ <h3 class="section-bar">Included Modules</h3>
101
+
102
+ <div id="includes-list">
103
+ <span class="include-name"><a href="ErrorHelper.html">Kwalify::ErrorHelper</a></span>
104
+ </div>
105
+ </div>
106
+
107
+ <div id="section">
108
+
109
+
110
+
111
+
112
+
113
+ <div id="attribute-list">
114
+ <h3 class="section-bar">Attributes</h3>
115
+
116
+ <div class="name-list">
117
+ <table>
118
+ <tr class="top-aligned-row context-row">
119
+ <td class="context-item-name">assert</td>
120
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
121
+ <td class="context-item-desc"></td>
122
+ </tr>
123
+ <tr class="top-aligned-row context-row">
124
+ <td class="context-item-name">assert_proc</td>
125
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
126
+ <td class="context-item-desc"></td>
127
+ </tr>
128
+ <tr class="top-aligned-row context-row">
129
+ <td class="context-item-name">classname</td>
130
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
131
+ <td class="context-item-desc"></td>
132
+ </tr>
133
+ <tr class="top-aligned-row context-row">
134
+ <td class="context-item-name">desc</td>
135
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
136
+ <td class="context-item-desc"></td>
137
+ </tr>
138
+ <tr class="top-aligned-row context-row">
139
+ <td class="context-item-name">enum</td>
140
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
141
+ <td class="context-item-desc"></td>
142
+ </tr>
143
+ <tr class="top-aligned-row context-row">
144
+ <td class="context-item-name">ident</td>
145
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
146
+ <td class="context-item-desc"></td>
147
+ </tr>
148
+ <tr class="top-aligned-row context-row">
149
+ <td class="context-item-name">length</td>
150
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
151
+ <td class="context-item-desc"></td>
152
+ </tr>
153
+ <tr class="top-aligned-row context-row">
154
+ <td class="context-item-name">mapping</td>
155
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
156
+ <td class="context-item-desc"></td>
157
+ </tr>
158
+ <tr class="top-aligned-row context-row">
159
+ <td class="context-item-name">name</td>
160
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
161
+ <td class="context-item-desc">
162
+ attr_reader :id
163
+
164
+ </td>
165
+ </tr>
166
+ <tr class="top-aligned-row context-row">
167
+ <td class="context-item-name">parent</td>
168
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
169
+ <td class="context-item-desc"></td>
170
+ </tr>
171
+ <tr class="top-aligned-row context-row">
172
+ <td class="context-item-name">pattern</td>
173
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
174
+ <td class="context-item-desc"></td>
175
+ </tr>
176
+ <tr class="top-aligned-row context-row">
177
+ <td class="context-item-name">range</td>
178
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
179
+ <td class="context-item-desc"></td>
180
+ </tr>
181
+ <tr class="top-aligned-row context-row">
182
+ <td class="context-item-name">regexp</td>
183
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
184
+ <td class="context-item-desc"></td>
185
+ </tr>
186
+ <tr class="top-aligned-row context-row">
187
+ <td class="context-item-name">required</td>
188
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
189
+ <td class="context-item-desc"></td>
190
+ </tr>
191
+ <tr class="top-aligned-row context-row">
192
+ <td class="context-item-name">sequence</td>
193
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
194
+ <td class="context-item-desc"></td>
195
+ </tr>
196
+ <tr class="top-aligned-row context-row">
197
+ <td class="context-item-name">type</td>
198
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
199
+ <td class="context-item-desc"></td>
200
+ </tr>
201
+ <tr class="top-aligned-row context-row">
202
+ <td class="context-item-name">type_class</td>
203
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
204
+ <td class="context-item-desc"></td>
205
+ </tr>
206
+ <tr class="top-aligned-row context-row">
207
+ <td class="context-item-name">unique</td>
208
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
209
+ <td class="context-item-desc"></td>
210
+ </tr>
211
+ </table>
212
+ </div>
213
+ </div>
214
+
215
+
216
+
217
+ <!-- if method_list -->
218
+ <div id="methods">
219
+ <h3 class="section-bar">Public Class methods</h3>
220
+
221
+ <div id="method-M000056" class="method-detail">
222
+ <a name="M000056"></a>
223
+
224
+ <div class="method-heading">
225
+ <a href="#M000056" class="method-signature">
226
+ <span class="method-name">new</span><span class="method-args">(hash=nil, parent=nil)</span>
227
+ </a>
228
+ </div>
229
+
230
+ <div class="method-description">
231
+ <p><a class="source-toggle" href="#"
232
+ onclick="toggleCode('M000056-source');return false;">[Source]</a></p>
233
+ <div class="method-source-code" id="M000056-source">
234
+ <pre>
235
+ <span class="ruby-comment cmt"># File kwalify/rule.rb, line 16</span>
236
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">hash</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">parent</span>=<span class="ruby-keyword kw">nil</span>)
237
+ <span class="ruby-identifier">init</span>(<span class="ruby-identifier">hash</span>, <span class="ruby-value str">&quot;&quot;</span>, {}) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hash</span>
238
+ <span class="ruby-ivar">@parent</span> = <span class="ruby-identifier">parent</span>
239
+ <span class="ruby-keyword kw">end</span>
240
+ </pre>
241
+ </div>
242
+ </div>
243
+ </div>
244
+
245
+ <h3 class="section-bar">Public Instance methods</h3>
246
+
247
+ <div id="method-M000057" class="method-detail">
248
+ <a name="M000057"></a>
249
+
250
+ <div class="method-heading">
251
+ <a href="#M000057" class="method-signature">
252
+ <span class="method-name">init</span><span class="method-args">(hash, path=&quot;&quot;, rule_table={})</span>
253
+ </a>
254
+ </div>
255
+
256
+ <div class="method-description">
257
+ <p><a class="source-toggle" href="#"
258
+ onclick="toggleCode('M000057-source');return false;">[Source]</a></p>
259
+ <div class="method-source-code" id="M000057-source">
260
+ <pre>
261
+ <span class="ruby-comment cmt"># File kwalify/rule.rb, line 41</span>
262
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">init</span>(<span class="ruby-identifier">hash</span>, <span class="ruby-identifier">path</span>=<span class="ruby-value str">&quot;&quot;</span>, <span class="ruby-identifier">rule_table</span>={})
263
+ <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
264
+ <span class="ruby-comment cmt">#* key=:schema_notmap msg=&quot;schema definition is not a mapping.&quot;</span>
265
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">Kwalify</span>.<span class="ruby-identifier">schema_error</span>(<span class="ruby-identifier">:schema_notmap</span>, <span class="ruby-keyword kw">nil</span>, (<span class="ruby-operator">!</span><span class="ruby-identifier">path</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-value">? </span><span class="ruby-value str">&quot;/&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">path</span>), <span class="ruby-keyword kw">nil</span>)
266
+ <span class="ruby-keyword kw">end</span>
267
+ <span class="ruby-identifier">rule</span> = <span class="ruby-keyword kw">self</span>
268
+ <span class="ruby-identifier">rule_table</span>[<span class="ruby-identifier">hash</span>.<span class="ruby-identifier">__id__</span>] = <span class="ruby-identifier">rule</span>
269
+ <span class="ruby-comment cmt">## 'type:' entry</span>
270
+ <span class="ruby-identifier">_init_type_value</span>(<span class="ruby-identifier">hash</span>[<span class="ruby-value str">'type'</span>], <span class="ruby-identifier">rule</span>, <span class="ruby-identifier">path</span>)
271
+ <span class="ruby-comment cmt">## other entries</span>
272
+ <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">val</span><span class="ruby-operator">|</span>
273
+ <span class="ruby-identifier">code</span> = <span class="ruby-identifier">key</span>.<span class="ruby-identifier">intern</span>
274
+ <span class="ruby-identifier">curr_path</span> = <span class="ruby-node">&quot;#{path}/#{key}&quot;</span>
275
+ <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">code</span>
276
+ <span class="ruby-comment cmt">#when &quot;id&quot;</span>
277
+ <span class="ruby-comment cmt"># @id = val</span>
278
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:type</span> ; <span class="ruby-comment cmt"># done</span>
279
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:name</span> ; <span class="ruby-identifier">_init_name_value</span>( <span class="ruby-identifier">val</span>, <span class="ruby-identifier">rule</span>, <span class="ruby-identifier">path</span>)
280
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:desc</span> ; <span class="ruby-identifier">_init_desc_value</span>( <span class="ruby-identifier">val</span>, <span class="ruby-identifier">rule</span>, <span class="ruby-identifier">path</span>)
281
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:required</span> ; <span class="ruby-identifier">_init_required_value</span>(<span class="ruby-identifier">val</span>, <span class="ruby-identifier">rule</span>, <span class="ruby-identifier">path</span>)
282
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:pattern</span> ; <span class="ruby-identifier">_init_pattern_value</span>( <span class="ruby-identifier">val</span>, <span class="ruby-identifier">rule</span>, <span class="ruby-identifier">path</span>)
283
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:enum</span> ; <span class="ruby-identifier">_init_enum_value</span>( <span class="ruby-identifier">val</span>, <span class="ruby-identifier">rule</span>, <span class="ruby-identifier">path</span>)
284
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:assert</span> ; <span class="ruby-identifier">_init_assert_value</span>( <span class="ruby-identifier">val</span>, <span class="ruby-identifier">rule</span>, <span class="ruby-identifier">path</span>)
285
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:range</span> ; <span class="ruby-identifier">_init_range_value</span>( <span class="ruby-identifier">val</span>, <span class="ruby-identifier">rule</span>, <span class="ruby-identifier">path</span>)
286
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:length</span> ; <span class="ruby-identifier">_init_length_value</span>( <span class="ruby-identifier">val</span>, <span class="ruby-identifier">rule</span>, <span class="ruby-identifier">path</span>)
287
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:ident</span> ; <span class="ruby-identifier">_init_ident_value</span>( <span class="ruby-identifier">val</span>, <span class="ruby-identifier">rule</span>, <span class="ruby-identifier">path</span>)
288
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:unique</span> ; <span class="ruby-identifier">_init_unique_value</span>( <span class="ruby-identifier">val</span>, <span class="ruby-identifier">rule</span>, <span class="ruby-identifier">path</span>)
289
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:sequence</span> ; <span class="ruby-identifier">_init_sequence_value</span>(<span class="ruby-identifier">val</span>, <span class="ruby-identifier">rule</span>, <span class="ruby-identifier">path</span>, <span class="ruby-identifier">rule_table</span>)
290
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:mapping</span> ; <span class="ruby-identifier">_init_mapping_value</span>( <span class="ruby-identifier">val</span>, <span class="ruby-identifier">rule</span>, <span class="ruby-identifier">path</span>, <span class="ruby-identifier">rule_table</span>)
291
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:classname</span> ; <span class="ruby-identifier">_init_classname_value</span>(<span class="ruby-identifier">val</span>, <span class="ruby-identifier">rule</span>, <span class="ruby-identifier">path</span>)
292
+ <span class="ruby-keyword kw">else</span>
293
+ <span class="ruby-comment cmt">#* key=:key_unknown msg=&quot;unknown key.&quot;</span>
294
+ <span class="ruby-identifier">raise</span> <span class="ruby-identifier">schema_error</span>(<span class="ruby-identifier">:key_unknown</span>, <span class="ruby-identifier">rule</span>, <span class="ruby-identifier">curr_path</span>, <span class="ruby-node">&quot;#{key}:&quot;</span>)
295
+ <span class="ruby-keyword kw">end</span>
296
+ <span class="ruby-keyword kw">end</span>
297
+ <span class="ruby-identifier">check_confliction</span>(<span class="ruby-identifier">hash</span>, <span class="ruby-identifier">rule</span>, <span class="ruby-identifier">path</span>)
298
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>
299
+ <span class="ruby-keyword kw">end</span>
300
+ </pre>
301
+ </div>
302
+ </div>
303
+ </div>
304
+
305
+ <h3 class="section-bar">Protected Instance methods</h3>
306
+
307
+ <div id="method-M000058" class="method-detail">
308
+ <a name="M000058"></a>
309
+
310
+ <div class="method-heading">
311
+ <a href="#M000058" class="method-signature">
312
+ <span class="method-name">_inspect</span><span class="method-args">(str=&quot;&quot;, level=0, done={})</span>
313
+ </a>
314
+ </div>
315
+
316
+ <div class="method-description">
317
+ <p>
318
+ def inspect()
319
+ </p>
320
+ <pre>
321
+ str = &quot;&quot;; level = 0; done = {}
322
+ _inspect(str, level, done)
323
+ return str
324
+ </pre>
325
+ <p>
326
+ end
327
+ </p>
328
+ <p><a class="source-toggle" href="#"
329
+ onclick="toggleCode('M000058-source');return false;">[Source]</a></p>
330
+ <div class="method-source-code" id="M000058-source">
331
+ <pre>
332
+ <span class="ruby-comment cmt"># File kwalify/rule.rb, line 437</span>
333
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_inspect</span>(<span class="ruby-identifier">str</span>=<span class="ruby-value str">&quot;&quot;</span>, <span class="ruby-identifier">level</span>=<span class="ruby-value">0</span>, <span class="ruby-identifier">done</span>={})
334
+ <span class="ruby-identifier">done</span>[<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">__id__</span>] = <span class="ruby-keyword kw">true</span>
335
+ <span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot; &quot;</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">level</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;name: #{@name}\n&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@name</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
336
+ <span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot; &quot;</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">level</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;desc: #{@desc}\n&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@desc</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
337
+ <span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot; &quot;</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">level</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;type: #{@type}\n&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@type</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
338
+ <span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot; &quot;</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">level</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;klass: #{@type_class.name}\n&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@type_class</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
339
+ <span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot; &quot;</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">level</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;required: #{@required}\n&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@required</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
340
+ <span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot; &quot;</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">level</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;pattern: #{@regexp.inspect}\n&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@pattern</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
341
+ <span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot; &quot;</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">level</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;assert: #{@assert}\n&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@assert</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
342
+ <span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot; &quot;</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">level</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;ident: #{@ident}\n&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@ident</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
343
+ <span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot; &quot;</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">level</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;unique: #{@unique}\n&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@unique</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
344
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@enum</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
345
+ <span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot; &quot;</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">level</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;enum:\n&quot;</span>
346
+ <span class="ruby-ivar">@enum</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span>
347
+ <span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot; &quot;</span> <span class="ruby-operator">*</span> (<span class="ruby-identifier">level</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>) <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;- #{item}\n&quot;</span>
348
+ <span class="ruby-keyword kw">end</span>
349
+ <span class="ruby-keyword kw">end</span>
350
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@range</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
351
+ <span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot; &quot;</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">level</span>
352
+ <span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;range: { &quot;</span>
353
+ <span class="ruby-identifier">colon</span> = <span class="ruby-value str">&quot;&quot;</span>
354
+ <span class="ruby-node">%w[max max-ex min min-ex]</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
355
+ <span class="ruby-identifier">val</span> = <span class="ruby-ivar">@range</span>[<span class="ruby-identifier">key</span>]
356
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">val</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
357
+ <span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">colon</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{key}: #{val.inspect}&quot;</span>
358
+ <span class="ruby-identifier">colon</span> = <span class="ruby-value str">&quot;, &quot;</span>
359
+ <span class="ruby-keyword kw">end</span>
360
+ <span class="ruby-keyword kw">end</span>
361
+ <span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot; }\n&quot;</span>
362
+ <span class="ruby-keyword kw">end</span>
363
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@length</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
364
+ <span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot; &quot;</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">level</span>
365
+ <span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;length: { &quot;</span>
366
+ <span class="ruby-identifier">colon</span> = <span class="ruby-value str">&quot;&quot;</span>
367
+ <span class="ruby-node">%w[max max-ex min min-ex]</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
368
+ <span class="ruby-identifier">val</span> = <span class="ruby-ivar">@length</span>[<span class="ruby-identifier">key</span>]
369
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">val</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
370
+ <span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">colon</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{key}: #{val.inspect}&quot;</span>
371
+ <span class="ruby-identifier">colon</span> = <span class="ruby-value str">&quot;, &quot;</span>
372
+ <span class="ruby-keyword kw">end</span>
373
+ <span class="ruby-keyword kw">end</span>
374
+ <span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot; }\n&quot;</span>
375
+ <span class="ruby-keyword kw">end</span>
376
+ <span class="ruby-ivar">@sequence</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">rule</span><span class="ruby-operator">|</span>
377
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">done</span>[<span class="ruby-identifier">rule</span>.<span class="ruby-identifier">__id__</span>]
378
+ <span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot; &quot;</span> <span class="ruby-operator">*</span> (<span class="ruby-identifier">level</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>) <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;- ...\n&quot;</span>
379
+ <span class="ruby-keyword kw">else</span>
380
+ <span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot; &quot;</span> <span class="ruby-operator">*</span> (<span class="ruby-identifier">level</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>) <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;- \n&quot;</span>
381
+ <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">_inspect</span>(<span class="ruby-identifier">str</span>, <span class="ruby-identifier">level</span><span class="ruby-operator">+</span><span class="ruby-value">2</span>, <span class="ruby-identifier">done</span>)
382
+ <span class="ruby-keyword kw">end</span>
383
+ <span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@sequence</span>
384
+ <span class="ruby-ivar">@mapping</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">rule</span><span class="ruby-operator">|</span>
385
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">done</span>[<span class="ruby-identifier">rule</span>.<span class="ruby-identifier">__id__</span>]
386
+ <span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">' '</span> <span class="ruby-operator">*</span> (<span class="ruby-identifier">level</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>) <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">'&quot;'</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">key</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;\&quot;: ...\n&quot;</span>
387
+ <span class="ruby-keyword kw">else</span>
388
+ <span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">' '</span> <span class="ruby-operator">*</span> (<span class="ruby-identifier">level</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>) <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">'&quot;'</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">key</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;\&quot;:\n&quot;</span>
389
+ <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">_inspect</span>(<span class="ruby-identifier">str</span>, <span class="ruby-identifier">level</span><span class="ruby-operator">+</span><span class="ruby-value">2</span>, <span class="ruby-identifier">done</span>)
390
+ <span class="ruby-keyword kw">end</span>
391
+ <span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@mapping</span>
392
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">str</span>
393
+ <span class="ruby-keyword kw">end</span>
394
+ </pre>
395
+ </div>
396
+ </div>
397
+ </div>
398
+
399
+
400
+ </div>
401
+
402
+
403
+ </div>
404
+
405
+
406
+ <div id="validator-badges">
407
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
408
+ </div>
409
+
410
+ </body>
411
+ </html>