hash_magic 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,18 +0,0 @@
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>
7
- <head>
8
- <title>new (OrderedHash)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/hash_magic.rb, line 337</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
15
- <span class="ruby-ivar">@keys_in_order</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">flatten</span>
16
- <span class="ruby-keyword kw">end</span></pre>
17
- </body>
18
- </html>
@@ -1,19 +0,0 @@
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>
7
- <head>
8
- <title>[]= (OrderedHash)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/hash_magic.rb, line 342</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]=</span>(<span class="ruby-identifier">key</span>,<span class="ruby-identifier">value</span>)
15
- <span class="ruby-ivar">@keys_in_order</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">key</span>
16
- <span class="ruby-keyword kw">super</span>
17
- <span class="ruby-keyword kw">end</span></pre>
18
- </body>
19
- </html>
@@ -1,18 +0,0 @@
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>
7
- <head>
8
- <title>inspect (OrderedHash)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/hash_magic.rb, line 346</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inspect</span>
15
- <span class="ruby-keyword kw">super</span>.<span class="ruby-identifier">insert</span>(<span class="ruby-value">1</span>,<span class="ruby-value str">'ordered: '</span>)
16
- <span class="ruby-keyword kw">end</span></pre>
17
- </body>
18
- </html>
@@ -1,18 +0,0 @@
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>
7
- <head>
8
- <title>keys (OrderedHash)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/hash_magic.rb, line 349</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">keys</span>
15
- <span class="ruby-keyword kw">super</span>.<span class="ruby-identifier">sort</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">a</span>,<span class="ruby-identifier">b</span><span class="ruby-operator">|</span> (<span class="ruby-ivar">@keys_in_order</span>.<span class="ruby-identifier">index</span>(<span class="ruby-identifier">a</span>) <span class="ruby-operator">||</span> <span class="ruby-value">-1</span>) <span class="ruby-operator">&lt;=&gt;</span> (<span class="ruby-ivar">@keys_in_order</span>.<span class="ruby-identifier">index</span>(<span class="ruby-identifier">b</span>) <span class="ruby-operator">||</span> <span class="ruby-value">-1</span>)}
16
- <span class="ruby-keyword kw">end</span></pre>
17
- </body>
18
- </html>
@@ -1,18 +0,0 @@
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>
7
- <head>
8
- <title>slashed (OrderedHash)</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11
- </head>
12
- <body class="standalone-code">
13
- <pre><span class="ruby-comment cmt"># File lib/hash_magic.rb, line 356</span>
14
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">slashed</span>
15
- <span class="ruby-constant">SlashedHash</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>).<span class="ruby-identifier">ordered!</span>(<span class="ruby-ivar">@keys_in_order</span>)
16
- <span class="ruby-keyword kw">end</span></pre>
17
- </body>
18
- </html>
@@ -1,373 +0,0 @@
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: SlashedHash</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">SlashedHash</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../files/lib/hash_magic_rb.html">
59
- lib/hash_magic.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="Hash.html">
69
- Hash
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
- <div id="description">
84
- <p>
85
- A <a href="SlashedHash.html">SlashedHash</a> is a hash whose values can be
86
- accessed in the normal manner, or with <a
87
- href="SlashedHash.html#M000006">keys</a> that are
88
- slash(&#8217;/&#8217;)-separated strings. To get the whole hash as a single
89
- flattened level, call <a
90
- href="SlashedHash.html#M000007">SlashedHash#flat</a>. All <a
91
- href="SlashedHash.html#M000006">keys</a> are converted to strings. All
92
- end-of-the-chain values are kept in whatever value they are.
93
- </p>
94
- <pre>
95
- s = {'a' =&gt; 'b', 'c' =&gt; {'d' =&gt; :e}}.slashed
96
- s['a'] #=&gt; 'b'
97
- s['c'] #=&gt; {slashed: 'd'=&gt;:e}
98
- s['c']['d'] #=&gt; :e
99
- s['c/d'] #=&gt; :e
100
- </pre>
101
-
102
- </div>
103
-
104
-
105
- </div>
106
-
107
- <div id="method-list">
108
- <h3 class="section-bar">Methods</h3>
109
-
110
- <div class="name-list">
111
- <a href="#M000002">[]</a>&nbsp;&nbsp;
112
- <a href="#M000003">[]=</a>&nbsp;&nbsp;
113
- <a href="#M000004">delete</a>&nbsp;&nbsp;
114
- <a href="#M000008">expand</a>&nbsp;&nbsp;
115
- <a href="#M000007">flat</a>&nbsp;&nbsp;
116
- <a href="#M000005">index</a>&nbsp;&nbsp;
117
- <a href="#M000006">keys</a>&nbsp;&nbsp;
118
- <a href="#M000001">new</a>&nbsp;&nbsp;
119
- <a href="#M000010">ordered</a>&nbsp;&nbsp;
120
- <a href="#M000011">ordered!</a>&nbsp;&nbsp;
121
- <a href="#M000009">to_string_array</a>&nbsp;&nbsp;
122
- </div>
123
- </div>
124
-
125
- </div>
126
-
127
-
128
- <!-- if includes -->
129
- <div id="includes">
130
- <h3 class="section-bar">Included Modules</h3>
131
-
132
- <div id="includes-list">
133
- <span class="include-name">StandardHashMethodsInRuby</span>
134
- </div>
135
- </div>
136
-
137
- <div id="section">
138
-
139
-
140
-
141
-
142
-
143
-
144
-
145
-
146
- <!-- if method_list -->
147
- <div id="methods">
148
- <h3 class="section-bar">Public Class methods</h3>
149
-
150
- <div id="method-M000001" class="method-detail">
151
- <a name="M000001"></a>
152
-
153
- <div class="method-heading">
154
- <a href="SlashedHash.src/M000001.html" target="Code" class="method-signature"
155
- onclick="popupCode('SlashedHash.src/M000001.html');return false;">
156
- <span class="method-name">new</span><span class="method-args">(hsh={})</span>
157
- </a>
158
- </div>
159
-
160
- <div class="method-description">
161
- </div>
162
- </div>
163
-
164
- <h3 class="section-bar">Public Instance methods</h3>
165
-
166
- <div id="method-M000002" class="method-detail">
167
- <a name="M000002"></a>
168
-
169
- <div class="method-heading">
170
- <a href="SlashedHash.src/M000002.html" target="Code" class="method-signature"
171
- onclick="popupCode('SlashedHash.src/M000002.html');return false;">
172
- <span class="method-name">[]</span><span class="method-args">(key)</span>
173
- </a>
174
- </div>
175
-
176
- <div class="method-description">
177
- <p>
178
- Behaves like the usual <a href="Hash.html">Hash</a>#[] method, but you can
179
- access nested hash values by composing a single key of the traversing <a
180
- href="SlashedHash.html#M000006">keys</a> joined by &#8217;/&#8217;:
181
- </p>
182
- <pre>
183
- hash['c']['d'] # is the same as:
184
- hash['c/d']
185
- </pre>
186
- </div>
187
- </div>
188
-
189
- <div id="method-M000003" class="method-detail">
190
- <a name="M000003"></a>
191
-
192
- <div class="method-heading">
193
- <a href="SlashedHash.src/M000003.html" target="Code" class="method-signature"
194
- onclick="popupCode('SlashedHash.src/M000003.html');return false;">
195
- <span class="method-name">[]=</span><span class="method-args">(key,value)</span>
196
- </a>
197
- </div>
198
-
199
- <div class="method-description">
200
- <p>
201
- Same as above, except sets value rather than retrieving it.
202
- </p>
203
- </div>
204
- </div>
205
-
206
- <div id="method-M000004" class="method-detail">
207
- <a name="M000004"></a>
208
-
209
- <div class="method-heading">
210
- <a href="SlashedHash.src/M000004.html" target="Code" class="method-signature"
211
- onclick="popupCode('SlashedHash.src/M000004.html');return false;">
212
- <span class="method-name">delete</span><span class="method-args">(key,&amp;block)</span>
213
- </a>
214
- </div>
215
-
216
- <div class="method-description">
217
- <p>
218
- You can use slashed <a href="SlashedHash.html#M000006">keys</a> here, too.
219
- </p>
220
- </div>
221
- </div>
222
-
223
- <div id="method-M000008" class="method-detail">
224
- <a name="M000008"></a>
225
-
226
- <div class="method-heading">
227
- <a href="SlashedHash.src/M000008.html" target="Code" class="method-signature"
228
- onclick="popupCode('SlashedHash.src/M000008.html');return false;">
229
- <span class="method-name">expand</span><span class="method-args">()</span>
230
- </a>
231
- </div>
232
-
233
- <div class="method-description">
234
- <p>
235
- Expands the whole hash to <a href="Hash.html">Hash</a> objects &#8230; not
236
- useful very often, it seems.
237
- </p>
238
- </div>
239
- </div>
240
-
241
- <div id="method-M000007" class="method-detail">
242
- <a name="M000007"></a>
243
-
244
- <div class="method-heading">
245
- <a href="SlashedHash.src/M000007.html" target="Code" class="method-signature"
246
- onclick="popupCode('SlashedHash.src/M000007.html');return false;">
247
- <span class="method-name">flat</span><span class="method-args">()</span>
248
- </a>
249
- </div>
250
-
251
- <div class="method-description">
252
- <p>
253
- Gives a list of all <a href="SlashedHash.html#M000006">keys</a> in all
254
- levels in the multi-level hash, joined by slashes.
255
- </p>
256
- <pre>
257
- {'a'=&gt;{'b'=&gt;'c', 'c'=&gt;'d'}, 'b'=&gt;'c'}.slashed.flat.keys
258
- =&gt; ['a/b', 'a/c', 'b']
259
- </pre>
260
- </div>
261
- </div>
262
-
263
- <div id="method-M000005" class="method-detail">
264
- <a name="M000005"></a>
265
-
266
- <div class="method-heading">
267
- <a href="SlashedHash.src/M000005.html" target="Code" class="method-signature"
268
- onclick="popupCode('SlashedHash.src/M000005.html');return false;">
269
- <span class="method-name">index</span><span class="method-args">(value)</span>
270
- </a>
271
- </div>
272
-
273
- <div class="method-description">
274
- <p>
275
- This gives you the slashed key of the value, no matter where the value is
276
- in the tree.
277
- </p>
278
- </div>
279
- </div>
280
-
281
- <div id="method-M000006" class="method-detail">
282
- <a name="M000006"></a>
283
-
284
- <div class="method-heading">
285
- <a href="SlashedHash.src/M000006.html" target="Code" class="method-signature"
286
- onclick="popupCode('SlashedHash.src/M000006.html');return false;">
287
- <span class="method-name">keys</span><span class="method-args">()</span>
288
- </a>
289
- </div>
290
-
291
- <div class="method-description">
292
- <p>
293
- This gives you only the top-level <a
294
- href="SlashedHash.html#M000006">keys</a>, no slashes. To get the list of
295
- slashed <a href="SlashedHash.html#M000006">keys</a>, do hash.flat.<a
296
- href="SlashedHash.html#M000006">keys</a>
297
- </p>
298
- </div>
299
- </div>
300
-
301
- <div id="method-M000010" class="method-detail">
302
- <a name="M000010"></a>
303
-
304
- <div class="method-heading">
305
- <a href="SlashedHash.src/M000010.html" target="Code" class="method-signature"
306
- onclick="popupCode('SlashedHash.src/M000010.html');return false;">
307
- <span class="method-name">ordered</span><span class="method-args">(*keys_in_order)</span>
308
- </a>
309
- </div>
310
-
311
- <div class="method-description">
312
- <p>
313
- Same as <a href="SlashedHash.html#M000011">ordered!</a> but returns a <a
314
- href="SlashedHash.html#M000001">new</a> <a
315
- href="SlashedHash.html">SlashedHash</a> object instead of modifying the
316
- same.
317
- </p>
318
- </div>
319
- </div>
320
-
321
- <div id="method-M000011" class="method-detail">
322
- <a name="M000011"></a>
323
-
324
- <div class="method-heading">
325
- <a href="SlashedHash.src/M000011.html" target="Code" class="method-signature"
326
- onclick="popupCode('SlashedHash.src/M000011.html');return false;">
327
- <span class="method-name">ordered!</span><span class="method-args">(*keys_in_order)</span>
328
- </a>
329
- </div>
330
-
331
- <div class="method-description">
332
- <p>
333
- Sets the SlashedArray as <a href="SlashedHash.html#M000010">ordered</a>.
334
- The *keys_in_order must be a <a href="SlashedHash.html#M000007">flat</a>
335
- array of slashed <a href="SlashedHash.html#M000006">keys</a> that specify
336
- the order for each level:
337
- </p>
338
- <pre>
339
- s = {'a'=&gt;{'b'=&gt;'c', 'c'=&gt;'d'}, 'b'=&gt;'c'}.slashed
340
- s.ordered!('b', 'a/c', 'a/b')
341
- s.expand # =&gt; {'b'=&gt;'c', 'a'=&gt;{'c'=&gt;'d', 'b'=&gt;'c'}}
342
- # Note that the expanded hashes will *still* be ordered!
343
- </pre>
344
- </div>
345
- </div>
346
-
347
- <div id="method-M000009" class="method-detail">
348
- <a name="M000009"></a>
349
-
350
- <div class="method-heading">
351
- <a href="SlashedHash.src/M000009.html" target="Code" class="method-signature"
352
- onclick="popupCode('SlashedHash.src/M000009.html');return false;">
353
- <span class="method-name">to_string_array</span><span class="method-args">()</span>
354
- </a>
355
- </div>
356
-
357
- <div class="method-description">
358
- </div>
359
- </div>
360
-
361
-
362
- </div>
363
-
364
-
365
- </div>
366
-
367
-
368
- <div id="validator-badges">
369
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
370
- </div>
371
-
372
- </body>
373
- </html>