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,168 @@
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::CommandOptionError</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::CommandOptionError</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/kwalify/main_rb.html">
59
+ kwalify/main.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
+ <a href="KwalifyError.html">
69
+ KwalifyError
70
+ </a>
71
+ </td>
72
+ </tr>
73
+ </table>
74
+ </div>
75
+ <!-- banner header -->
76
+
77
+ <div id="bodyContent">
78
+
79
+
80
+
81
+ <div id="contextContent">
82
+
83
+
84
+
85
+ </div>
86
+
87
+ <div id="method-list">
88
+ <h3 class="section-bar">Methods</h3>
89
+
90
+ <div class="name-list">
91
+ <a href="#M000063">new</a>&nbsp;&nbsp;
92
+ </div>
93
+ </div>
94
+
95
+ </div>
96
+
97
+
98
+ <!-- if includes -->
99
+
100
+ <div id="section">
101
+
102
+
103
+
104
+
105
+
106
+ <div id="attribute-list">
107
+ <h3 class="section-bar">Attributes</h3>
108
+
109
+ <div class="name-list">
110
+ <table>
111
+ <tr class="top-aligned-row context-row">
112
+ <td class="context-item-name">error_symbol</td>
113
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
114
+ <td class="context-item-desc"></td>
115
+ </tr>
116
+ <tr class="top-aligned-row context-row">
117
+ <td class="context-item-name">option</td>
118
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
119
+ <td class="context-item-desc"></td>
120
+ </tr>
121
+ </table>
122
+ </div>
123
+ </div>
124
+
125
+
126
+
127
+ <!-- if method_list -->
128
+ <div id="methods">
129
+ <h3 class="section-bar">Public Class methods</h3>
130
+
131
+ <div id="method-M000063" class="method-detail">
132
+ <a name="M000063"></a>
133
+
134
+ <div class="method-heading">
135
+ <a href="#M000063" class="method-signature">
136
+ <span class="method-name">new</span><span class="method-args">(message, option, error_symbol)</span>
137
+ </a>
138
+ </div>
139
+
140
+ <div class="method-description">
141
+ <p><a class="source-toggle" href="#"
142
+ onclick="toggleCode('M000063-source');return false;">[Source]</a></p>
143
+ <div class="method-source-code" id="M000063-source">
144
+ <pre>
145
+ <span class="ruby-comment cmt"># File kwalify/main.rb, line 18</span>
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
+ </pre>
152
+ </div>
153
+ </div>
154
+ </div>
155
+
156
+
157
+ </div>
158
+
159
+
160
+ </div>
161
+
162
+
163
+ <div id="validator-badges">
164
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
165
+ </div>
166
+
167
+ </body>
168
+ </html>
@@ -0,0 +1,218 @@
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::ErrorHelper</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::ErrorHelper</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/kwalify/errors_rb.html">
59
+ kwalify/errors.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
+ <div id="method-list">
80
+ <h3 class="section-bar">Methods</h3>
81
+
82
+ <div class="name-list">
83
+ <a href="#M000023">_build_message</a>&nbsp;&nbsp;
84
+ <a href="#M000020">assert_error</a>&nbsp;&nbsp;
85
+ <a href="#M000022">schema_error</a>&nbsp;&nbsp;
86
+ <a href="#M000021">validate_error</a>&nbsp;&nbsp;
87
+ </div>
88
+ </div>
89
+
90
+ </div>
91
+
92
+
93
+ <!-- if includes -->
94
+
95
+ <div id="section">
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+ <!-- if method_list -->
105
+ <div id="methods">
106
+ <h3 class="section-bar">Public Instance methods</h3>
107
+
108
+ <div id="method-M000023" class="method-detail">
109
+ <a name="M000023"></a>
110
+
111
+ <div class="method-heading">
112
+ <a href="#M000023" class="method-signature">
113
+ <span class="method-name">_build_message</span><span class="method-args">(message_key, val, args)</span>
114
+ </a>
115
+ </div>
116
+
117
+ <div class="method-description">
118
+ <p><a class="source-toggle" href="#"
119
+ onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
120
+ <div class="method-source-code" id="M000023-source">
121
+ <pre>
122
+ <span class="ruby-comment cmt"># File kwalify/errors.rb, line 93</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">&quot;message_key=#{message_key.inspect}&quot;</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">&quot;'#{val.to_s.gsub(/\n/, '\n')}': #{msg}&quot;</span> <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> <span class="ruby-operator">&amp;&amp;</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
+ </pre>
131
+ </div>
132
+ </div>
133
+ </div>
134
+
135
+ <div id="method-M000020" class="method-detail">
136
+ <a name="M000020"></a>
137
+
138
+ <div class="method-heading">
139
+ <a href="#M000020" class="method-signature">
140
+ <span class="method-name">assert_error</span><span class="method-args">(message=&quot;&quot;)</span>
141
+ </a>
142
+ </div>
143
+
144
+ <div class="method-description">
145
+ <p><a class="source-toggle" href="#"
146
+ onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
147
+ <div class="method-source-code" id="M000020-source">
148
+ <pre>
149
+ <span class="ruby-comment cmt"># File kwalify/errors.rb, line 79</span>
150
+ <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">&quot;&quot;</span>)
151
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">AssertionError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">message</span>)
152
+ <span class="ruby-keyword kw">end</span>
153
+ </pre>
154
+ </div>
155
+ </div>
156
+ </div>
157
+
158
+ <div id="method-M000022" class="method-detail">
159
+ <a name="M000022"></a>
160
+
161
+ <div class="method-heading">
162
+ <a href="#M000022" class="method-signature">
163
+ <span class="method-name">schema_error</span><span class="method-args">(error_symbol, rule, path, val, args=nil)</span>
164
+ </a>
165
+ </div>
166
+
167
+ <div class="method-description">
168
+ <p><a class="source-toggle" href="#"
169
+ onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
170
+ <div class="method-source-code" id="M000022-source">
171
+ <pre>
172
+ <span class="ruby-comment cmt"># File kwalify/errors.rb, line 88</span>
173
+ <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>)
174
+ <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>);
175
+ <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>)
176
+ <span class="ruby-keyword kw">end</span>
177
+ </pre>
178
+ </div>
179
+ </div>
180
+ </div>
181
+
182
+ <div id="method-M000021" class="method-detail">
183
+ <a name="M000021"></a>
184
+
185
+ <div class="method-heading">
186
+ <a href="#M000021" class="method-signature">
187
+ <span class="method-name">validate_error</span><span class="method-args">(error_symbol, rule, path, val, args=nil)</span>
188
+ </a>
189
+ </div>
190
+
191
+ <div class="method-description">
192
+ <p><a class="source-toggle" href="#"
193
+ onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
194
+ <div class="method-source-code" id="M000021-source">
195
+ <pre>
196
+ <span class="ruby-comment cmt"># File kwalify/errors.rb, line 83</span>
197
+ <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>)
198
+ <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>);
199
+ <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>)
200
+ <span class="ruby-keyword kw">end</span>
201
+ </pre>
202
+ </div>
203
+ </div>
204
+ </div>
205
+
206
+
207
+ </div>
208
+
209
+
210
+ </div>
211
+
212
+
213
+ <div id="validator-badges">
214
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
215
+ </div>
216
+
217
+ </body>
218
+ </html>
@@ -0,0 +1,240 @@
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::HashInterface</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::HashInterface</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/kwalify/util/hash-interface_rb.html">
59
+ kwalify/util/hash-interface.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
+ <div id="method-list">
80
+ <h3 class="section-bar">Methods</h3>
81
+
82
+ <div class="name-list">
83
+ <a href="#M000015">[]</a>&nbsp;&nbsp;
84
+ <a href="#M000016">[]=</a>&nbsp;&nbsp;
85
+ <a href="#M000019">each</a>&nbsp;&nbsp;
86
+ <a href="#M000018">key?</a>&nbsp;&nbsp;
87
+ <a href="#M000017">keys</a>&nbsp;&nbsp;
88
+ </div>
89
+ </div>
90
+
91
+ </div>
92
+
93
+
94
+ <!-- if includes -->
95
+
96
+ <div id="section">
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">&quot;@{key}&quot;</span>)
126
+ <span class="ruby-keyword kw">end</span>
127
+ </pre>
128
+ </div>
129
+ </div>
130
+ </div>
131
+
132
+ <div id="method-M000016" class="method-detail">
133
+ <a name="M000016"></a>
134
+
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">&quot;@{key}&quot;</span>, <span class="ruby-identifier">val</span>)
149
+ <span class="ruby-keyword kw">end</span>
150
+ </pre>
151
+ </div>
152
+ </div>
153
+ </div>
154
+
155
+ <div id="method-M000019" class="method-detail">
156
+ <a name="M000019"></a>
157
+
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
+
182
+ <div id="method-M000018" class="method-detail">
183
+ <a name="M000018"></a>
184
+
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
+
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">&quot;@#{key}&quot;</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
+
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
+
228
+
229
+ </div>
230
+
231
+
232
+ </div>
233
+
234
+
235
+ <div id="validator-badges">
236
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
237
+ </div>
238
+
239
+ </body>
240
+ </html>