yagni 1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rspec +1 -0
- data/.rvmrc +55 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +32 -0
- data/Guardfile +5 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +59 -0
- data/lib/yell/hash.rb +122 -0
- data/lib/yell/version.rb +5 -0
- data/lib/yell.rb +6 -0
- data/rdoc/README_rdoc.html +132 -0
- data/rdoc/Yell/Hash.html +554 -0
- data/rdoc/Yell.html +158 -0
- data/rdoc/created.rid +5 -0
- data/rdoc/index.html +72 -0
- data/rdoc/lib/yell/hash_rb.html +55 -0
- data/rdoc/lib/yell/version_rb.html +55 -0
- data/rdoc/lib/yell_rb.html +52 -0
- data/rdoc/rdoc.css +706 -0
- data/spec/spec_helper.rb +12 -0
- data/spec/yell/hash_spec.rb +83 -0
- metadata +122 -0
data/rdoc/Yell/Hash.html
ADDED
@@ -0,0 +1,554 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
|
7
|
+
|
8
|
+
<title>Class: Yell::Hash</title>
|
9
|
+
|
10
|
+
<link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
|
11
|
+
|
12
|
+
<script src="../js/jquery.js" type="text/javascript"
|
13
|
+
charset="utf-8"></script>
|
14
|
+
<script src="../js/thickbox-compressed.js" type="text/javascript"
|
15
|
+
charset="utf-8"></script>
|
16
|
+
<script src="../js/quicksearch.js" type="text/javascript"
|
17
|
+
charset="utf-8"></script>
|
18
|
+
<script src="../js/darkfish.js" type="text/javascript"
|
19
|
+
charset="utf-8"></script>
|
20
|
+
|
21
|
+
</head>
|
22
|
+
<body class="class">
|
23
|
+
|
24
|
+
<div id="metadata">
|
25
|
+
<div id="home-metadata">
|
26
|
+
<div id="home-section" class="section">
|
27
|
+
<h3 class="section-header">
|
28
|
+
<a href="../index.html">Home</a>
|
29
|
+
<a href="../index.html#classes">Classes</a>
|
30
|
+
<a href="../index.html#methods">Methods</a>
|
31
|
+
</h3>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="file-metadata">
|
36
|
+
<div id="file-list-section" class="section">
|
37
|
+
<h3 class="section-header">In Files</h3>
|
38
|
+
<div class="section-body">
|
39
|
+
<ul>
|
40
|
+
|
41
|
+
<li><a href="../lib/yell/hash_rb.html?TB_iframe=true&height=550&width=785"
|
42
|
+
class="thickbox" title="lib/yell/hash.rb">lib/yell/hash.rb</a></li>
|
43
|
+
|
44
|
+
</ul>
|
45
|
+
</div>
|
46
|
+
</div>
|
47
|
+
|
48
|
+
|
49
|
+
</div>
|
50
|
+
|
51
|
+
<div id="class-metadata">
|
52
|
+
|
53
|
+
<!-- Parent Class -->
|
54
|
+
|
55
|
+
<div id="parent-class-section" class="section">
|
56
|
+
<h3 class="section-header">Parent</h3>
|
57
|
+
|
58
|
+
<p class="link">Object</p>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
|
62
|
+
|
63
|
+
<!-- Namespace Contents -->
|
64
|
+
|
65
|
+
|
66
|
+
<!-- Method Quickref -->
|
67
|
+
|
68
|
+
<div id="method-list-section" class="section">
|
69
|
+
<h3 class="section-header">Methods</h3>
|
70
|
+
<ul class="link-list">
|
71
|
+
|
72
|
+
<li><a href="#method-c-new">::new</a></li>
|
73
|
+
|
74
|
+
<li><a href="#method-i-change_context_to">#change_context_to</a></li>
|
75
|
+
|
76
|
+
<li><a href="#method-i-define_key_methods">#define_key_methods</a></li>
|
77
|
+
|
78
|
+
<li><a href="#method-i-load_data_from">#load_data_from</a></li>
|
79
|
+
|
80
|
+
<li><a href="#method-i-method_missing">#method_missing</a></li>
|
81
|
+
|
82
|
+
<li><a href="#method-i-respond_to%3F">#respond_to?</a></li>
|
83
|
+
|
84
|
+
<li><a href="#method-i-singleton_class">#singleton_class</a></li>
|
85
|
+
|
86
|
+
<li><a href="#method-i-symbolize_keys%21">#symbolize_keys!</a></li>
|
87
|
+
|
88
|
+
</ul>
|
89
|
+
</div>
|
90
|
+
|
91
|
+
|
92
|
+
<!-- Included Modules -->
|
93
|
+
|
94
|
+
</div>
|
95
|
+
|
96
|
+
<div id="project-metadata">
|
97
|
+
|
98
|
+
|
99
|
+
<div id="fileindex-section" class="section project-section">
|
100
|
+
<h3 class="section-header">Files</h3>
|
101
|
+
<ul>
|
102
|
+
|
103
|
+
<li class="file"><a href="../README_rdoc.html">README.rdoc</a></li>
|
104
|
+
|
105
|
+
</ul>
|
106
|
+
</div>
|
107
|
+
|
108
|
+
|
109
|
+
<div id="classindex-section" class="section project-section">
|
110
|
+
<h3 class="section-header">Class Index
|
111
|
+
<span class="search-toggle"><img src="../images/find.png"
|
112
|
+
height="16" width="16" alt="[+]"
|
113
|
+
title="show/hide quicksearch" /></span></h3>
|
114
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
115
|
+
<fieldset>
|
116
|
+
<legend>Quicksearch</legend>
|
117
|
+
<input type="text" name="quicksearch" value=""
|
118
|
+
class="quicksearch-field" />
|
119
|
+
</fieldset>
|
120
|
+
</form>
|
121
|
+
|
122
|
+
<ul class="link-list">
|
123
|
+
|
124
|
+
<li><a href="../Yell/Hash.html">Yell::Hash</a></li>
|
125
|
+
|
126
|
+
</ul>
|
127
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
128
|
+
</div>
|
129
|
+
|
130
|
+
|
131
|
+
</div>
|
132
|
+
</div>
|
133
|
+
|
134
|
+
<div id="documentation">
|
135
|
+
<h1 class="class">Yell::Hash</h1>
|
136
|
+
|
137
|
+
<div id="description">
|
138
|
+
<p>
|
139
|
+
<a href="Hash.html">Yell::Hash</a> is a class that provides easy access to
|
140
|
+
members, in a method-like syntax.
|
141
|
+
</p>
|
142
|
+
<p>
|
143
|
+
Usage:
|
144
|
+
</p>
|
145
|
+
<pre>
|
146
|
+
h = Yell::Hash.new({ :my => 'hash',
|
147
|
+
:is => { :just => 'awesome!' }
|
148
|
+
})
|
149
|
+
|
150
|
+
h.my #=> "hash"
|
151
|
+
h.is.just #=> "awesome!"
|
152
|
+
</pre>
|
153
|
+
<p>
|
154
|
+
You can also pass an arbitrary file with your data, as long as you have a
|
155
|
+
class which responds to the class method <tt>parse</tt> that will take a
|
156
|
+
string with the file content and make it a hash. For example, the
|
157
|
+
<tt>JSON</tt> class is a perfect example (as it has a method <tt>parse</tt>
|
158
|
+
that takes a json string and returns the corresponding hash)
|
159
|
+
</p>
|
160
|
+
<pre>
|
161
|
+
# File: data.json
|
162
|
+
|
163
|
+
{
|
164
|
+
"my": "json",
|
165
|
+
|
166
|
+
"is": {
|
167
|
+
"just": "awesome!"
|
168
|
+
}
|
169
|
+
}
|
170
|
+
|
171
|
+
# File: test.rb
|
172
|
+
require 'json'
|
173
|
+
require 'yell'
|
174
|
+
y = Yell::Hash.new('data.json', JSON)
|
175
|
+
y.my #=> "json"
|
176
|
+
y.is.just #=> "awesome!"</pre>
|
177
|
+
|
178
|
+
</div>
|
179
|
+
|
180
|
+
<!-- Constants -->
|
181
|
+
|
182
|
+
|
183
|
+
<!-- Attributes -->
|
184
|
+
|
185
|
+
|
186
|
+
<!-- Methods -->
|
187
|
+
|
188
|
+
<div id="public-class-method-details" class="method-section section">
|
189
|
+
<h3 class="section-header">Public Class Methods</h3>
|
190
|
+
|
191
|
+
|
192
|
+
<div id="new-method" class="method-detail ">
|
193
|
+
<a name="method-c-new"></a>
|
194
|
+
|
195
|
+
<div class="method-heading">
|
196
|
+
|
197
|
+
<span class="method-name">new</span><span
|
198
|
+
class="method-args">(data, parser=nil)</span>
|
199
|
+
<span class="method-click-advice">click to toggle source</span>
|
200
|
+
|
201
|
+
</div>
|
202
|
+
|
203
|
+
<div class="method-description">
|
204
|
+
|
205
|
+
<p>
|
206
|
+
Creates a new <a href="Hash.html">Yell::Hash</a> object. You can pass it a
|
207
|
+
hash directly, or a file name (containing your data) with a parser class
|
208
|
+
which responds to the class level method <tt>parse</tt> taking a string
|
209
|
+
with the file content and returns the corresponding hash of your data.
|
210
|
+
</p>
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
<div class="method-source-code"
|
215
|
+
id="new-source">
|
216
|
+
<pre>
|
217
|
+
<span class="ruby-comment cmt"># File lib/yell/hash.rb, line 46</span>
|
218
|
+
46: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">data</span>, <span class="ruby-identifier">parser</span>=<span class="ruby-keyword kw">nil</span>)
|
219
|
+
47: <span class="ruby-ivar">@data</span> = <span class="ruby-ivar">@context</span> = {}
|
220
|
+
48: <span class="ruby-ivar">@parser</span> = <span class="ruby-identifier">parser</span>
|
221
|
+
49:
|
222
|
+
50: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">data</span>
|
223
|
+
51: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Object</span><span class="ruby-operator">::</span><span class="ruby-constant">Hash</span>
|
224
|
+
52: <span class="ruby-ivar">@data</span> = <span class="ruby-identifier">data</span>
|
225
|
+
53:
|
226
|
+
54: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">String</span>
|
227
|
+
55: <span class="ruby-identifier">load_data_from</span>(<span class="ruby-identifier">data</span>)
|
228
|
+
56: <span class="ruby-keyword kw">end</span>
|
229
|
+
57:
|
230
|
+
58: <span class="ruby-identifier">symbolize_keys!</span> <span class="ruby-ivar">@data</span>
|
231
|
+
59: <span class="ruby-ivar">@context</span> = <span class="ruby-ivar">@data</span>
|
232
|
+
60:
|
233
|
+
61: <span class="ruby-identifier">define_key_methods</span>
|
234
|
+
62: <span class="ruby-keyword kw">end</span></pre>
|
235
|
+
</div>
|
236
|
+
|
237
|
+
</div>
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
</div>
|
243
|
+
|
244
|
+
|
245
|
+
</div>
|
246
|
+
|
247
|
+
<div id="public-instance-method-details" class="method-section section">
|
248
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
249
|
+
|
250
|
+
|
251
|
+
<div id="load-data-from-method" class="method-detail ">
|
252
|
+
<a name="method-i-load_data_from"></a>
|
253
|
+
|
254
|
+
<div class="method-heading">
|
255
|
+
|
256
|
+
<span class="method-name">load_data_from</span><span
|
257
|
+
class="method-args">(file)</span>
|
258
|
+
<span class="method-click-advice">click to toggle source</span>
|
259
|
+
|
260
|
+
</div>
|
261
|
+
|
262
|
+
<div class="method-description">
|
263
|
+
|
264
|
+
<p>
|
265
|
+
Loads the data in the given file and calls the method <tt>parse</tt> on the
|
266
|
+
given parser class
|
267
|
+
</p>
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
<div class="method-source-code"
|
272
|
+
id="load-data-from-source">
|
273
|
+
<pre>
|
274
|
+
<span class="ruby-comment cmt"># File lib/yell/hash.rb, line 66</span>
|
275
|
+
66: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load_data_from</span>(<span class="ruby-identifier">file</span>)
|
276
|
+
67: <span class="ruby-identifier">file_content</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">file</span>)
|
277
|
+
68: <span class="ruby-ivar">@data</span> = <span class="ruby-ivar">@parser</span>.<span class="ruby-identifier">parse</span> <span class="ruby-identifier">file_content</span>
|
278
|
+
69: <span class="ruby-keyword kw">end</span></pre>
|
279
|
+
</div>
|
280
|
+
|
281
|
+
</div>
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
</div>
|
287
|
+
|
288
|
+
|
289
|
+
<div id="method-missing-method" class="method-detail ">
|
290
|
+
<a name="method-i-method_missing"></a>
|
291
|
+
|
292
|
+
<div class="method-heading">
|
293
|
+
|
294
|
+
<span class="method-name">method_missing</span><span
|
295
|
+
class="method-args">(meth, *args, &block)</span>
|
296
|
+
<span class="method-click-advice">click to toggle source</span>
|
297
|
+
|
298
|
+
</div>
|
299
|
+
|
300
|
+
<div class="method-description">
|
301
|
+
|
302
|
+
<p>
|
303
|
+
If the method called is in the current context, we return the value (if it
|
304
|
+
is not another <tt>Hash</tt>); or <tt>self</tt>, allowing key chaining
|
305
|
+
</p>
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
<div class="method-source-code"
|
310
|
+
id="method-missing-source">
|
311
|
+
<pre>
|
312
|
+
<span class="ruby-comment cmt"># File lib/yell/hash.rb, line 74</span>
|
313
|
+
74: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">meth</span>, *<span class="ruby-identifier">args</span>, &<span class="ruby-identifier">block</span>)
|
314
|
+
75: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">meth</span>)
|
315
|
+
76: <span class="ruby-identifier">change_context_to</span> <span class="ruby-identifier">meth</span>
|
316
|
+
77: <span class="ruby-keyword kw">else</span>
|
317
|
+
78: <span class="ruby-keyword kw">super</span>
|
318
|
+
79: <span class="ruby-keyword kw">end</span>
|
319
|
+
80: <span class="ruby-keyword kw">end</span></pre>
|
320
|
+
</div>
|
321
|
+
|
322
|
+
</div>
|
323
|
+
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
</div>
|
328
|
+
|
329
|
+
|
330
|
+
<div id="respond-to--method" class="method-detail ">
|
331
|
+
<a name="method-i-respond_to%3F"></a>
|
332
|
+
|
333
|
+
<div class="method-heading">
|
334
|
+
|
335
|
+
<span class="method-name">respond_to?</span><span
|
336
|
+
class="method-args">(meth)</span>
|
337
|
+
<span class="method-click-advice">click to toggle source</span>
|
338
|
+
|
339
|
+
</div>
|
340
|
+
|
341
|
+
<div class="method-description">
|
342
|
+
|
343
|
+
<p>
|
344
|
+
Updates <tt>respond_to</tt>, so that it will return true for method names
|
345
|
+
for which there is a corresponding key
|
346
|
+
</p>
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
<div class="method-source-code"
|
351
|
+
id="respond-to--source">
|
352
|
+
<pre>
|
353
|
+
<span class="ruby-comment cmt"># File lib/yell/hash.rb, line 84</span>
|
354
|
+
84: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">meth</span>)
|
355
|
+
85: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@data</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">meth</span>
|
356
|
+
86: <span class="ruby-keyword kw">true</span>
|
357
|
+
87: <span class="ruby-keyword kw">else</span>
|
358
|
+
88: <span class="ruby-keyword kw">super</span>
|
359
|
+
89: <span class="ruby-keyword kw">end</span>
|
360
|
+
90: <span class="ruby-keyword kw">end</span></pre>
|
361
|
+
</div>
|
362
|
+
|
363
|
+
</div>
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
|
368
|
+
</div>
|
369
|
+
|
370
|
+
|
371
|
+
<div id="symbolize-keys--method" class="method-detail ">
|
372
|
+
<a name="method-i-symbolize_keys%21"></a>
|
373
|
+
|
374
|
+
<div class="method-heading">
|
375
|
+
|
376
|
+
<span class="method-name">symbolize_keys!</span><span
|
377
|
+
class="method-args">(hash)</span>
|
378
|
+
<span class="method-click-advice">click to toggle source</span>
|
379
|
+
|
380
|
+
</div>
|
381
|
+
|
382
|
+
<div class="method-description">
|
383
|
+
|
384
|
+
<p>
|
385
|
+
Makes all keys symbols, avoiding comparison problems
|
386
|
+
</p>
|
387
|
+
|
388
|
+
|
389
|
+
|
390
|
+
<div class="method-source-code"
|
391
|
+
id="symbolize-keys--source">
|
392
|
+
<pre>
|
393
|
+
<span class="ruby-comment cmt"># File lib/yell/hash.rb, line 93</span>
|
394
|
+
93: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">symbolize_keys!</span>(<span class="ruby-identifier">hash</span>)
|
395
|
+
94: <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">keys</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>
|
396
|
+
95: <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_sym</span>] = <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">key</span>)
|
397
|
+
96: <span class="ruby-keyword kw">end</span>
|
398
|
+
97:
|
399
|
+
98: <span class="ruby-identifier">hash</span>
|
400
|
+
99: <span class="ruby-keyword kw">end</span></pre>
|
401
|
+
</div>
|
402
|
+
|
403
|
+
</div>
|
404
|
+
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
</div>
|
409
|
+
|
410
|
+
|
411
|
+
</div>
|
412
|
+
|
413
|
+
<div id="private-instance-method-details" class="method-section section">
|
414
|
+
<h3 class="section-header">Private Instance Methods</h3>
|
415
|
+
|
416
|
+
|
417
|
+
<div id="change-context-to-method" class="method-detail ">
|
418
|
+
<a name="method-i-change_context_to"></a>
|
419
|
+
|
420
|
+
<div class="method-heading">
|
421
|
+
|
422
|
+
<span class="method-name">change_context_to</span><span
|
423
|
+
class="method-args">(key)</span>
|
424
|
+
<span class="method-click-advice">click to toggle source</span>
|
425
|
+
|
426
|
+
</div>
|
427
|
+
|
428
|
+
<div class="method-description">
|
429
|
+
|
430
|
+
|
431
|
+
|
432
|
+
|
433
|
+
|
434
|
+
<div class="method-source-code"
|
435
|
+
id="change-context-to-source">
|
436
|
+
<pre>
|
437
|
+
<span class="ruby-comment cmt"># File lib/yell/hash.rb, line 119</span>
|
438
|
+
119: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">change_context_to</span>(<span class="ruby-identifier">key</span>)
|
439
|
+
120: <span class="ruby-ivar">@context</span> = <span class="ruby-ivar">@context</span>[<span class="ruby-identifier">key</span>]
|
440
|
+
121:
|
441
|
+
122: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@context</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Object</span><span class="ruby-operator">::</span><span class="ruby-constant">Hash</span>
|
442
|
+
123: <span class="ruby-identifier">symbolize_keys!</span> <span class="ruby-ivar">@context</span>
|
443
|
+
124: <span class="ruby-keyword kw">self</span>
|
444
|
+
125: <span class="ruby-keyword kw">else</span>
|
445
|
+
126: <span class="ruby-ivar">@context</span>
|
446
|
+
127: <span class="ruby-keyword kw">end</span>
|
447
|
+
128: <span class="ruby-keyword kw">end</span></pre>
|
448
|
+
</div>
|
449
|
+
|
450
|
+
</div>
|
451
|
+
|
452
|
+
|
453
|
+
|
454
|
+
|
455
|
+
</div>
|
456
|
+
|
457
|
+
|
458
|
+
<div id="define-key-methods-method" class="method-detail ">
|
459
|
+
<a name="method-i-define_key_methods"></a>
|
460
|
+
|
461
|
+
<div class="method-heading">
|
462
|
+
|
463
|
+
<span class="method-name">define_key_methods</span><span
|
464
|
+
class="method-args">()</span>
|
465
|
+
<span class="method-click-advice">click to toggle source</span>
|
466
|
+
|
467
|
+
</div>
|
468
|
+
|
469
|
+
<div class="method-description">
|
470
|
+
|
471
|
+
<p>
|
472
|
+
Defines methods for every key in the @data variable. If a key is simple
|
473
|
+
(its value is not another <tt>Hash</tt>), then the value itself is
|
474
|
+
returned; otherwise, we return <tt>self</tt> so that keys can be chained.
|
475
|
+
</p>
|
476
|
+
|
477
|
+
|
478
|
+
|
479
|
+
<div class="method-source-code"
|
480
|
+
id="define-key-methods-source">
|
481
|
+
<pre>
|
482
|
+
<span class="ruby-comment cmt"># File lib/yell/hash.rb, line 111</span>
|
483
|
+
111: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">define_key_methods</span>
|
484
|
+
112: <span class="ruby-ivar">@data</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span>
|
485
|
+
113: <span class="ruby-identifier">singleton_class</span>.<span class="ruby-identifier">send</span>(<span class="ruby-value">:define_method</span>, <span class="ruby-identifier">k</span>) <span class="ruby-keyword kw">do</span>
|
486
|
+
114: <span class="ruby-identifier">change_context_to</span> <span class="ruby-identifier">k</span>
|
487
|
+
115: <span class="ruby-keyword kw">end</span>
|
488
|
+
116: <span class="ruby-keyword kw">end</span>
|
489
|
+
117: <span class="ruby-keyword kw">end</span></pre>
|
490
|
+
</div>
|
491
|
+
|
492
|
+
</div>
|
493
|
+
|
494
|
+
|
495
|
+
|
496
|
+
|
497
|
+
</div>
|
498
|
+
|
499
|
+
|
500
|
+
<div id="singleton-class-method" class="method-detail ">
|
501
|
+
<a name="method-i-singleton_class"></a>
|
502
|
+
|
503
|
+
<div class="method-heading">
|
504
|
+
|
505
|
+
<span class="method-name">singleton_class</span><span
|
506
|
+
class="method-args">()</span>
|
507
|
+
<span class="method-click-advice">click to toggle source</span>
|
508
|
+
|
509
|
+
</div>
|
510
|
+
|
511
|
+
<div class="method-description">
|
512
|
+
|
513
|
+
|
514
|
+
|
515
|
+
|
516
|
+
|
517
|
+
<div class="method-source-code"
|
518
|
+
id="singleton-class-source">
|
519
|
+
<pre>
|
520
|
+
<span class="ruby-comment cmt"># File lib/yell/hash.rb, line 103</span>
|
521
|
+
103: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">singleton_class</span>
|
522
|
+
104: <span class="ruby-keyword kw">class</span> <span class="ruby-operator"><<</span> <span class="ruby-keyword kw">self</span>; <span class="ruby-keyword kw">self</span>; <span class="ruby-keyword kw">end</span>
|
523
|
+
105: <span class="ruby-keyword kw">end</span></pre>
|
524
|
+
</div>
|
525
|
+
|
526
|
+
</div>
|
527
|
+
|
528
|
+
|
529
|
+
|
530
|
+
|
531
|
+
</div>
|
532
|
+
|
533
|
+
|
534
|
+
</div>
|
535
|
+
|
536
|
+
|
537
|
+
</div>
|
538
|
+
|
539
|
+
|
540
|
+
<div id="rdoc-debugging-section-dump" class="debugging-section">
|
541
|
+
|
542
|
+
<p>Disabled; run with --debug to generate this.</p>
|
543
|
+
|
544
|
+
</div>
|
545
|
+
|
546
|
+
<div id="validator-badges">
|
547
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
548
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
549
|
+
Rdoc Generator</a> 1.1.6</small>.</p>
|
550
|
+
</div>
|
551
|
+
|
552
|
+
</body>
|
553
|
+
</html>
|
554
|
+
|