method_cacheable 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,180 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Module: JohnnyCache::ClassMethods
8
+
9
+ &mdash; Documentation by YARD 0.7.2
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ relpath = '..';
19
+ if (relpath != '') relpath += '/';
20
+ </script>
21
+
22
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
23
+
24
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
25
+
26
+
27
+ </head>
28
+ <body>
29
+ <script type="text/javascript" charset="utf-8">
30
+ if (window.top.frames.main) document.body.className = 'frames';
31
+ </script>
32
+
33
+ <div id="header">
34
+ <div id="menu">
35
+
36
+ <a href="../_index.html">Index (C)</a> &raquo;
37
+ <span class='title'><span class='object_link'><a href="../JohnnyCache.html" title="JohnnyCache (module)">JohnnyCache</a></span></span>
38
+ &raquo;
39
+ <span class="title">ClassMethods</span>
40
+
41
+
42
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
43
+ </div>
44
+
45
+ <div id="search">
46
+
47
+ <a id="class_list_link" href="#">Class List</a>
48
+
49
+ <a id="method_list_link" href="#">Method List</a>
50
+
51
+ <a id="file_list_link" href="#">File List</a>
52
+
53
+ </div>
54
+ <div class="clear"></div>
55
+ </div>
56
+
57
+ <iframe id="search_frame"></iframe>
58
+
59
+ <div id="content"><h1>Module: JohnnyCache::ClassMethods
60
+
61
+
62
+
63
+ </h1>
64
+
65
+ <dl class="box">
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+ <dt class="r1 last">Defined in:</dt>
75
+ <dd class="r1 last">lib/johnny_cache.rb</dd>
76
+
77
+ </dl>
78
+ <div class="clear"></div>
79
+
80
+
81
+
82
+
83
+
84
+
85
+
86
+ <h2>
87
+ Instance Method Summary
88
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
89
+ </h2>
90
+
91
+ <ul class="summary">
92
+
93
+ <li class="public ">
94
+ <span class="summary_signature">
95
+
96
+ <a href="#cache-instance_method" title="#cache (instance method)">- (Object) <strong>cache</strong>(*args) </a>
97
+
98
+
99
+
100
+ </span>
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+ <span class="summary_desc"><div class='inline'>
110
+ </div></span>
111
+
112
+ </li>
113
+
114
+
115
+ </ul>
116
+
117
+
118
+
119
+
120
+ <div id="instance_method_details" class="method_details_list">
121
+ <h2>Instance Method Details</h2>
122
+
123
+
124
+ <div class="method_details first">
125
+ <p class="signature first" id="cache-instance_method">
126
+
127
+ - (<tt>Object</tt>) <strong>cache</strong>(*args)
128
+
129
+
130
+
131
+ </p><div class="docstring">
132
+ <div class="discussion">
133
+
134
+
135
+
136
+ </div>
137
+ </div>
138
+ <div class="tags">
139
+
140
+ <h3>See Also:</h3>
141
+ <ul class="see">
142
+
143
+ <li><span class='object_link'><a href="../JohnnyCache.html#cache-instance_method" title="JohnnyCache#cache (method)">JohnnyCache#cache</a></span></li>
144
+
145
+ </ul>
146
+
147
+ </div><table class="source_code">
148
+ <tr>
149
+ <td>
150
+ <pre class="lines">
151
+
152
+
153
+ 76
154
+ 77
155
+ 78</pre>
156
+ </td>
157
+ <td>
158
+ <pre class="code"><span class="info file"># File 'lib/johnny_cache.rb', line 76</span>
159
+
160
+ <span class='def def kw'>def</span> <span class='cache identifier id'>cache</span><span class='lparen token'>(</span><span class='mult op'>*</span><span class='args identifier id'>args</span><span class='rparen token'>)</span>
161
+ <span class='MethodCache constant id'>MethodCache</span><span class='dot token'>.</span><span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='self self kw'>self</span><span class='comma token'>,</span> <span class='mult op'>*</span><span class='args identifier id'>args</span><span class='rparen token'>)</span>
162
+ <span class='end end kw'>end</span>
163
+ </pre>
164
+ </td>
165
+ </tr>
166
+ </table>
167
+ </div>
168
+
169
+ </div>
170
+
171
+ </div>
172
+
173
+ <div id="footer">
174
+ Generated on Sun Aug 7 21:40:15 2011 by
175
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
176
+ 0.7.2 (ruby-1.8.7).
177
+ </div>
178
+
179
+ </body>
180
+ </html>
@@ -0,0 +1,835 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Class: JohnnyCache::MethodCache
8
+
9
+ &mdash; Documentation by YARD 0.7.2
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ relpath = '..';
19
+ if (relpath != '') relpath += '/';
20
+ </script>
21
+
22
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
23
+
24
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
25
+
26
+
27
+ </head>
28
+ <body>
29
+ <script type="text/javascript" charset="utf-8">
30
+ if (window.top.frames.main) document.body.className = 'frames';
31
+ </script>
32
+
33
+ <div id="header">
34
+ <div id="menu">
35
+
36
+ <a href="../_index.html">Index (M)</a> &raquo;
37
+ <span class='title'><span class='object_link'><a href="../JohnnyCache.html" title="JohnnyCache (module)">JohnnyCache</a></span></span>
38
+ &raquo;
39
+ <span class="title">MethodCache</span>
40
+
41
+
42
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
43
+ </div>
44
+
45
+ <div id="search">
46
+
47
+ <a id="class_list_link" href="#">Class List</a>
48
+
49
+ <a id="method_list_link" href="#">Method List</a>
50
+
51
+ <a id="file_list_link" href="#">File List</a>
52
+
53
+ </div>
54
+ <div class="clear"></div>
55
+ </div>
56
+
57
+ <iframe id="search_frame"></iframe>
58
+
59
+ <div id="content"><h1>Class: JohnnyCache::MethodCache
60
+
61
+
62
+
63
+ </h1>
64
+
65
+ <dl class="box">
66
+
67
+ <dt class="r1">Inherits:</dt>
68
+ <dd class="r1">
69
+ <span class="inheritName">Object</span>
70
+
71
+ <ul class="fullTree">
72
+ <li>Object</li>
73
+
74
+ <li class="next">JohnnyCache::MethodCache</li>
75
+
76
+ </ul>
77
+ <a href="#" class="inheritanceTree">show all</a>
78
+
79
+ </dd>
80
+
81
+
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+ <dt class="r2 last">Defined in:</dt>
90
+ <dd class="r2 last">lib/johnny_cache.rb</dd>
91
+
92
+ </dl>
93
+ <div class="clear"></div>
94
+
95
+
96
+
97
+ <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
98
+ <ul class="summary">
99
+
100
+ <li class="public ">
101
+ <span class="summary_signature">
102
+
103
+ <a href="#args-instance_method" title="#args (instance method)">- (Object) <strong>args</strong> </a>
104
+
105
+
106
+
107
+ </span>
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+ <span class="summary_desc"><div class='inline'><p>Returns the value of attribute args.</p>
120
+ </div></span>
121
+
122
+ </li>
123
+
124
+
125
+ <li class="public ">
126
+ <span class="summary_signature">
127
+
128
+ <a href="#cache_operation-instance_method" title="#cache_operation (instance method)">- (Object) <strong>cache_operation</strong> </a>
129
+
130
+
131
+
132
+ </span>
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+ <span class="summary_desc"><div class='inline'><p>Returns the value of attribute cache_operation.</p>
145
+ </div></span>
146
+
147
+ </li>
148
+
149
+
150
+ <li class="public ">
151
+ <span class="summary_signature">
152
+
153
+ <a href="#caller_object-instance_method" title="#caller_object (instance method)">- (Object) <strong>caller_object</strong> </a>
154
+
155
+
156
+
157
+ </span>
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+ <span class="summary_desc"><div class='inline'><p>Returns the value of attribute caller_object.</p>
170
+ </div></span>
171
+
172
+ </li>
173
+
174
+
175
+ <li class="public ">
176
+ <span class="summary_signature">
177
+
178
+ <a href="#method-instance_method" title="#method (instance method)">- (Object) <strong>method</strong> </a>
179
+
180
+
181
+
182
+ </span>
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+ <span class="summary_desc"><div class='inline'><p>Returns the value of attribute method.</p>
195
+ </div></span>
196
+
197
+ </li>
198
+
199
+
200
+ <li class="public ">
201
+ <span class="summary_signature">
202
+
203
+ <a href="#options-instance_method" title="#options (instance method)">- (Object) <strong>options</strong> </a>
204
+
205
+
206
+
207
+ </span>
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+ <span class="summary_desc"><div class='inline'><p>Returns the value of attribute options.</p>
220
+ </div></span>
221
+
222
+ </li>
223
+
224
+
225
+ </ul>
226
+
227
+
228
+
229
+
230
+
231
+ <h2>
232
+ Instance Method Summary
233
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
234
+ </h2>
235
+
236
+ <ul class="summary">
237
+
238
+ <li class="public ">
239
+ <span class="summary_signature">
240
+
241
+ <a href="#call_cache_operation-instance_method" title="#call_cache_operation (instance method)">- (Object) <strong>call_cache_operation</strong>(options = {}) </a>
242
+
243
+
244
+
245
+ </span>
246
+
247
+
248
+
249
+
250
+
251
+
252
+
253
+
254
+ <span class="summary_desc"><div class='inline'><p>Calls the cache based on the given cache_operation.</p>
255
+ </div></span>
256
+
257
+ </li>
258
+
259
+
260
+ <li class="public ">
261
+ <span class="summary_signature">
262
+
263
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (MethodCache) <strong>initialize</strong>(caller_object, *method_cache_args) </a>
264
+
265
+
266
+
267
+ </span>
268
+
269
+ <span class="note title constructor">constructor</span>
270
+
271
+
272
+
273
+
274
+
275
+
276
+
277
+
278
+ <span class="summary_desc"><div class='inline'><p>A new instance of MethodCache.</p>
279
+ </div></span>
280
+
281
+ </li>
282
+
283
+
284
+ <li class="public ">
285
+ <span class="summary_signature">
286
+
287
+ <a href="#key-instance_method" title="#key (instance method)">- (Object) <strong>key</strong> </a>
288
+
289
+
290
+
291
+ </span>
292
+
293
+
294
+
295
+
296
+
297
+
298
+
299
+
300
+ <span class="summary_desc"><div class='inline'><p>Uses keytar to create a key based on the method and caller if no method_key exits.</p>
301
+ </div></span>
302
+
303
+ </li>
304
+
305
+
306
+ <li class="public ">
307
+ <span class="summary_signature">
308
+
309
+ <a href="#method_missing-instance_method" title="#method_missing (instance method)">- (Object) <strong>method_missing</strong>(method, *args, &amp;blk) </a>
310
+
311
+
312
+
313
+ </span>
314
+
315
+
316
+
317
+
318
+
319
+
320
+
321
+
322
+ <span class="summary_desc"><div class='inline'><p>Methods caught by method_missing are passed to the caller_object and used to :write, :read, or :fetch from the cache.</p>
323
+ </div></span>
324
+
325
+ </li>
326
+
327
+
328
+ </ul>
329
+
330
+
331
+ <div id="constructor_details" class="method_details_list">
332
+ <h2>Constructor Details</h2>
333
+
334
+ <div class="method_details first">
335
+ <p class="signature first" id="initialize-instance_method">
336
+
337
+ - (<tt><span class='object_link'><a href="" title="JohnnyCache::MethodCache (class)">MethodCache</a></span></tt>) <strong>initialize</strong>(caller_object, *method_cache_args)
338
+
339
+
340
+
341
+ </p><div class="docstring">
342
+ <div class="discussion">
343
+ <p>A new instance of MethodCache</p>
344
+
345
+
346
+ </div>
347
+ </div>
348
+ <div class="tags">
349
+
350
+ </div><table class="source_code">
351
+ <tr>
352
+ <td>
353
+ <pre class="lines">
354
+
355
+
356
+ 88
357
+ 89
358
+ 90
359
+ 91
360
+ 92
361
+ 93
362
+ 94</pre>
363
+ </td>
364
+ <td>
365
+ <pre class="code"><span class="info file"># File 'lib/johnny_cache.rb', line 88</span>
366
+
367
+ <span class='def def kw'>def</span> <span class='initialize identifier id'>initialize</span><span class='lparen token'>(</span><span class='caller_object identifier id'>caller_object</span><span class='comma token'>,</span> <span class='mult op'>*</span><span class='method_cache_args identifier id'>method_cache_args</span><span class='rparen token'>)</span>
368
+ <span class='cache_operation identifier id'>cache_operation</span> <span class='assign token'>=</span> <span class='method_cache_args identifier id'>method_cache_args</span><span class='dot token'>.</span><span class='map identifier id'>map</span> <span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='x identifier id'>x</span><span class='bitor op'>|</span> <span class='x identifier id'>x</span> <span class='if if_mod kw'>if</span> <span class='x identifier id'>x</span><span class='dot token'>.</span><span class='is_a? fid id'>is_a?</span> <span class='Symbol constant id'>Symbol</span> <span class='rbrace token'>}</span><span class='dot token'>.</span><span class='compact identifier id'>compact</span><span class='dot token'>.</span><span class='first identifier id'>first</span>
369
+ <span class='options identifier id'>options</span> <span class='assign token'>=</span> <span class='method_cache_args identifier id'>method_cache_args</span><span class='dot token'>.</span><span class='map identifier id'>map</span> <span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='x identifier id'>x</span><span class='bitor op'>|</span> <span class='x identifier id'>x</span> <span class='if if_mod kw'>if</span> <span class='x identifier id'>x</span><span class='dot token'>.</span><span class='is_a? fid id'>is_a?</span> <span class='Hash constant id'>Hash</span> <span class='rbrace token'>}</span><span class='dot token'>.</span><span class='compact identifier id'>compact</span><span class='dot token'>.</span><span class='first identifier id'>first</span>
370
+ <span class='self self kw'>self</span><span class='dot token'>.</span><span class='cache_operation identifier id'>cache_operation</span> <span class='assign token'>=</span> <span class='cache_operation identifier id'>cache_operation</span><span class='orop op'>||</span><span class='symbol val'>:fetch</span>
371
+ <span class='self self kw'>self</span><span class='dot token'>.</span><span class='options identifier id'>options</span> <span class='assign token'>=</span> <span class='options identifier id'>options</span>
372
+ <span class='self self kw'>self</span><span class='dot token'>.</span><span class='caller_object identifier id'>caller_object</span> <span class='assign token'>=</span> <span class='caller_object identifier id'>caller_object</span>
373
+ <span class='end end kw'>end</span>
374
+ </pre>
375
+ </td>
376
+ </tr>
377
+ </table>
378
+ </div>
379
+
380
+ </div>
381
+ <div id="method_missing_details" class="method_details_list">
382
+ <h2>Dynamic Method Handling</h2>
383
+ <p class="notice this">
384
+ This class handles dynamic methods through the <tt>method_missing</tt> method
385
+
386
+ </p>
387
+
388
+ <div class="method_details first">
389
+ <p class="signature first" id="method_missing-instance_method">
390
+
391
+ - (<tt>Object</tt>) <strong>method_missing</strong>(method, *args, &amp;blk)
392
+
393
+
394
+
395
+ </p><div class="docstring">
396
+ <div class="discussion">
397
+ <p>Methods caught by method_missing are passed to the caller_object and used to :write, :read, or :fetch from the cache</p>
398
+
399
+
400
+ </div>
401
+ </div>
402
+ <div class="tags">
403
+
404
+ <h3>See Also:</h3>
405
+ <ul class="see">
406
+
407
+ <li><span class='object_link'><a href="../JohnnyCache.html#cache-instance_method" title="JohnnyCache#cache (method)">JohnnyCache#cache</a></span></li>
408
+
409
+ </ul>
410
+
411
+ </div><table class="source_code">
412
+ <tr>
413
+ <td>
414
+ <pre class="lines">
415
+
416
+
417
+ 128
418
+ 129
419
+ 130
420
+ 131
421
+ 132
422
+ 133
423
+ 134
424
+ 135
425
+ 136</pre>
426
+ </td>
427
+ <td>
428
+ <pre class="code"><span class="info file"># File 'lib/johnny_cache.rb', line 128</span>
429
+
430
+ <span class='def def kw'>def</span> <span class='method_missing identifier id'>method_missing</span><span class='lparen token'>(</span><span class='method identifier id'>method</span><span class='comma token'>,</span> <span class='mult op'>*</span><span class='args identifier id'>args</span><span class='comma token'>,</span> <span class='bitand op'>&amp;</span><span class='blk identifier id'>blk</span><span class='rparen token'>)</span>
431
+ <span class='if if kw'>if</span> <span class='caller_object identifier id'>caller_object</span><span class='dot token'>.</span><span class='respond_to? fid id'>respond_to?</span> <span class='method identifier id'>method</span>
432
+ <span class='self self kw'>self</span><span class='dot token'>.</span><span class='method identifier id'>method</span> <span class='assign token'>=</span> <span class='method identifier id'>method</span>
433
+ <span class='self self kw'>self</span><span class='dot token'>.</span><span class='args identifier id'>args</span> <span class='assign token'>=</span> <span class='args identifier id'>args</span>
434
+ <span class='call_cache_operation identifier id'>call_cache_operation</span><span class='lparen token'>(</span><span class='options identifier id'>options</span><span class='rparen token'>)</span>
435
+ <span class='else else kw'>else</span>
436
+ <span class='super super kw'>super</span>
437
+ <span class='end end kw'>end</span>
438
+ <span class='end end kw'>end</span>
439
+ </pre>
440
+ </td>
441
+ </tr>
442
+ </table>
443
+ </div>
444
+
445
+ </div>
446
+
447
+ <div id="instance_attr_details" class="attr_details">
448
+ <h2>Instance Attribute Details</h2>
449
+
450
+
451
+ <span id="args=-instance_method"></span>
452
+ <span id="args-instance_method"></span>
453
+ <div class="method_details first">
454
+ <p class="signature first" id="args-instance_method">
455
+
456
+ - (<tt>Object</tt>) <strong>args</strong>
457
+
458
+
459
+
460
+ </p><div class="docstring">
461
+ <div class="discussion">
462
+ <p>Returns the value of attribute args</p>
463
+
464
+
465
+ </div>
466
+ </div>
467
+ <div class="tags">
468
+
469
+ </div><table class="source_code">
470
+ <tr>
471
+ <td>
472
+ <pre class="lines">
473
+
474
+
475
+ 86
476
+ 87
477
+ 88</pre>
478
+ </td>
479
+ <td>
480
+ <pre class="code"><span class="info file"># File 'lib/johnny_cache.rb', line 86</span>
481
+
482
+ <span class='def def kw'>def</span> <span class='args identifier id'>args</span>
483
+ <span class='@args ivar id'>@args</span>
484
+ <span class='end end kw'>end</span>
485
+ </pre>
486
+ </td>
487
+ </tr>
488
+ </table>
489
+ </div>
490
+
491
+
492
+ <span id="cache_operation=-instance_method"></span>
493
+ <span id="cache_operation-instance_method"></span>
494
+ <div class="method_details ">
495
+ <p class="signature " id="cache_operation-instance_method">
496
+
497
+ - (<tt>Object</tt>) <strong>cache_operation</strong>
498
+
499
+
500
+
501
+ </p><div class="docstring">
502
+ <div class="discussion">
503
+ <p>Returns the value of attribute cache_operation</p>
504
+
505
+
506
+ </div>
507
+ </div>
508
+ <div class="tags">
509
+
510
+ </div><table class="source_code">
511
+ <tr>
512
+ <td>
513
+ <pre class="lines">
514
+
515
+
516
+ 86
517
+ 87
518
+ 88</pre>
519
+ </td>
520
+ <td>
521
+ <pre class="code"><span class="info file"># File 'lib/johnny_cache.rb', line 86</span>
522
+
523
+ <span class='def def kw'>def</span> <span class='cache_operation identifier id'>cache_operation</span>
524
+ <span class='@cache_operation ivar id'>@cache_operation</span>
525
+ <span class='end end kw'>end</span>
526
+ </pre>
527
+ </td>
528
+ </tr>
529
+ </table>
530
+ </div>
531
+
532
+
533
+ <span id="caller_object=-instance_method"></span>
534
+ <span id="caller_object-instance_method"></span>
535
+ <div class="method_details ">
536
+ <p class="signature " id="caller_object-instance_method">
537
+
538
+ - (<tt>Object</tt>) <strong>caller_object</strong>
539
+
540
+
541
+
542
+ </p><div class="docstring">
543
+ <div class="discussion">
544
+ <p>Returns the value of attribute caller_object</p>
545
+
546
+
547
+ </div>
548
+ </div>
549
+ <div class="tags">
550
+
551
+ </div><table class="source_code">
552
+ <tr>
553
+ <td>
554
+ <pre class="lines">
555
+
556
+
557
+ 86
558
+ 87
559
+ 88</pre>
560
+ </td>
561
+ <td>
562
+ <pre class="code"><span class="info file"># File 'lib/johnny_cache.rb', line 86</span>
563
+
564
+ <span class='def def kw'>def</span> <span class='caller_object identifier id'>caller_object</span>
565
+ <span class='@caller_object ivar id'>@caller_object</span>
566
+ <span class='end end kw'>end</span>
567
+ </pre>
568
+ </td>
569
+ </tr>
570
+ </table>
571
+ </div>
572
+
573
+
574
+ <span id="method=-instance_method"></span>
575
+ <span id="method-instance_method"></span>
576
+ <div class="method_details ">
577
+ <p class="signature " id="method-instance_method">
578
+
579
+ - (<tt>Object</tt>) <strong>method</strong>
580
+
581
+
582
+
583
+ </p><div class="docstring">
584
+ <div class="discussion">
585
+ <p>Returns the value of attribute method</p>
586
+
587
+
588
+ </div>
589
+ </div>
590
+ <div class="tags">
591
+
592
+ </div><table class="source_code">
593
+ <tr>
594
+ <td>
595
+ <pre class="lines">
596
+
597
+
598
+ 86
599
+ 87
600
+ 88</pre>
601
+ </td>
602
+ <td>
603
+ <pre class="code"><span class="info file"># File 'lib/johnny_cache.rb', line 86</span>
604
+
605
+ <span class='def def kw'>def</span> <span class='method identifier id'>method</span>
606
+ <span class='@method ivar id'>@method</span>
607
+ <span class='end end kw'>end</span>
608
+ </pre>
609
+ </td>
610
+ </tr>
611
+ </table>
612
+ </div>
613
+
614
+
615
+ <span id="options=-instance_method"></span>
616
+ <span id="options-instance_method"></span>
617
+ <div class="method_details ">
618
+ <p class="signature " id="options-instance_method">
619
+
620
+ - (<tt>Object</tt>) <strong>options</strong>
621
+
622
+
623
+
624
+ </p><div class="docstring">
625
+ <div class="discussion">
626
+ <p>Returns the value of attribute options</p>
627
+
628
+
629
+ </div>
630
+ </div>
631
+ <div class="tags">
632
+
633
+ </div><table class="source_code">
634
+ <tr>
635
+ <td>
636
+ <pre class="lines">
637
+
638
+
639
+ 86
640
+ 87
641
+ 88</pre>
642
+ </td>
643
+ <td>
644
+ <pre class="code"><span class="info file"># File 'lib/johnny_cache.rb', line 86</span>
645
+
646
+ <span class='def def kw'>def</span> <span class='options identifier id'>options</span>
647
+ <span class='@options ivar id'>@options</span>
648
+ <span class='end end kw'>end</span>
649
+ </pre>
650
+ </td>
651
+ </tr>
652
+ </table>
653
+ </div>
654
+
655
+ </div>
656
+
657
+
658
+ <div id="instance_method_details" class="method_details_list">
659
+ <h2>Instance Method Details</h2>
660
+
661
+
662
+ <div class="method_details first">
663
+ <p class="signature first" id="call_cache_operation-instance_method">
664
+
665
+ - (<tt>Object</tt>) <strong>call_cache_operation</strong>(options = {})
666
+
667
+
668
+
669
+ </p><div class="docstring">
670
+ <div class="discussion">
671
+ <p>Calls the cache based on the given cache_operation</p>
672
+
673
+
674
+ </div>
675
+ </div>
676
+ <div class="tags">
677
+ <h3>Parameters:</h3>
678
+ <ul class="param">
679
+
680
+ <li>
681
+
682
+ <span class='name'>options</span>
683
+
684
+
685
+ <span class='type'>(<tt>Hash</tt>)</span>
686
+
687
+
688
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
689
+
690
+
691
+ &mdash;
692
+ <div class='inline'><p>Options are passed to the cache store</p>
693
+ </div>
694
+
695
+ </li>
696
+
697
+ </ul>
698
+
699
+ <h3>See Also:</h3>
700
+ <ul class="see">
701
+
702
+ <li><a href="http://api.rubyonrails.org/classes/ActionController/Caching.html#method-i-cache" target="_parent" title="Rails.cache documentation">Rails.cache documentation</a></li>
703
+
704
+ </ul>
705
+
706
+ </div><table class="source_code">
707
+ <tr>
708
+ <td>
709
+ <pre class="lines">
710
+
711
+
712
+ 112
713
+ 113
714
+ 114
715
+ 115
716
+ 116
717
+ 117
718
+ 118
719
+ 119
720
+ 120
721
+ 121
722
+ 122
723
+ 123</pre>
724
+ </td>
725
+ <td>
726
+ <pre class="code"><span class="info file"># File 'lib/johnny_cache.rb', line 112</span>
727
+
728
+ <span class='def def kw'>def</span> <span class='call_cache_operation identifier id'>call_cache_operation</span><span class='lparen token'>(</span><span class='options identifier id'>options</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='rparen token'>)</span>
729
+ <span class='if if kw'>if</span> <span class='cache_operation identifier id'>cache_operation</span> <span class='eq op'>==</span> <span class='symbol val'>:fetch</span>
730
+ <span class='JohnnyCache constant id'>JohnnyCache</span><span class='colon2 op'>::</span><span class='STORE constant id'>STORE</span><span class='dot token'>.</span><span class='fetch identifier id'>fetch</span><span class='lparen token'>(</span><span class='key identifier id'>key</span><span class='comma token'>,</span> <span class='options identifier id'>options</span><span class='rparen token'>)</span> <span class='do do kw'>do</span>
731
+ <span class='caller_object identifier id'>caller_object</span><span class='dot token'>.</span><span class='send identifier id'>send</span> <span class='method identifier id'>method</span><span class='dot token'>.</span><span class='to_sym identifier id'>to_sym</span><span class='comma token'>,</span> <span class='mult op'>*</span><span class='args identifier id'>args</span>
732
+ <span class='end end kw'>end</span>
733
+ <span class='elsif elsif kw'>elsif</span> <span class='cache_operation identifier id'>cache_operation</span> <span class='eq op'>==</span> <span class='symbol val'>:read</span>
734
+ <span class='JohnnyCache constant id'>JohnnyCache</span><span class='colon2 op'>::</span><span class='STORE constant id'>STORE</span><span class='dot token'>.</span><span class='read identifier id'>read</span><span class='lparen token'>(</span><span class='key identifier id'>key</span><span class='comma token'>,</span> <span class='options identifier id'>options</span><span class='rparen token'>)</span>
735
+ <span class='elsif elsif kw'>elsif</span> <span class='cache_operation identifier id'>cache_operation</span> <span class='eq op'>==</span> <span class='symbol val'>:write</span>
736
+ <span class='val identifier id'>val</span> <span class='assign token'>=</span> <span class='caller_object identifier id'>caller_object</span><span class='dot token'>.</span><span class='send identifier id'>send</span> <span class='method identifier id'>method</span><span class='dot token'>.</span><span class='to_sym identifier id'>to_sym</span><span class='comma token'>,</span> <span class='mult op'>*</span><span class='args identifier id'>args</span>
737
+ <span class='JohnnyCache constant id'>JohnnyCache</span><span class='colon2 op'>::</span><span class='STORE constant id'>STORE</span><span class='dot token'>.</span><span class='write identifier id'>write</span><span class='lparen token'>(</span><span class='key identifier id'>key</span><span class='comma token'>,</span> <span class='val identifier id'>val</span><span class='comma token'>,</span> <span class='options identifier id'>options</span><span class='rparen token'>)</span>
738
+ <span class='end end kw'>end</span>
739
+ <span class='end end kw'>end</span>
740
+ </pre>
741
+ </td>
742
+ </tr>
743
+ </table>
744
+ </div>
745
+
746
+ <div class="method_details ">
747
+ <p class="signature " id="key-instance_method">
748
+
749
+ - (<tt>Object</tt>) <strong>key</strong>
750
+
751
+
752
+
753
+ </p><div class="docstring">
754
+ <div class="discussion">
755
+ <p>Uses keytar to create a key based on the method and caller if no method_key exits</p>
756
+
757
+
758
+ </div>
759
+ </div>
760
+ <div class="tags">
761
+
762
+ <div class="examples">
763
+ <h3>Examples:</h3>
764
+
765
+ <h4><div class='inline'>
766
+ </div></h4>
767
+ <pre class="example code"><span class='cache identifier id'>cache</span> <span class='assign token'>=</span> <span class='User constant id'>User</span><span class='dot token'>.</span><span class='find identifier id'>find</span><span class='lparen token'>(</span><span class='integer val'>263619</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='cache identifier id'>cache</span> <span class='comment val'># =&gt; #&lt;JohnnyCache::MethodCache ... &gt;</span>
768
+ <span class='cache identifier id'>cache</span><span class='dot token'>.</span><span class='method identifier id'>method</span> <span class='assign token'>=</span> <span class='string val'>&quot;foo&quot;</span> <span class='comment val'># =&gt; &quot;foo&quot;</span>
769
+ <span class='cache identifier id'>cache</span><span class='dot token'>.</span><span class='key identifier id'>key</span> <span class='comment val'># =&gt; &quot;users:foo:263619&quot;</span>
770
+ </pre>
771
+
772
+ </div>
773
+ <h3>Returns:</h3>
774
+ <ul class="return">
775
+
776
+ <li>
777
+
778
+
779
+ <span class='type'></span>
780
+
781
+
782
+
783
+
784
+ <div class='inline'><p>the key used to set the cache</p>
785
+ </div>
786
+
787
+ </li>
788
+
789
+ </ul>
790
+
791
+ <h3>See Also:</h3>
792
+ <ul class="see">
793
+
794
+ <li><a href="http://github.com/schneems/keytar" target="_parent" title="Keytar, it builds keys">Keytar, it builds keys</a></li>
795
+
796
+ </ul>
797
+
798
+ </div><table class="source_code">
799
+ <tr>
800
+ <td>
801
+ <pre class="lines">
802
+
803
+
804
+ 103
805
+ 104
806
+ 105
807
+ 106
808
+ 107</pre>
809
+ </td>
810
+ <td>
811
+ <pre class="code"><span class="info file"># File 'lib/johnny_cache.rb', line 103</span>
812
+
813
+ <span class='def def kw'>def</span> <span class='key identifier id'>key</span>
814
+ <span class='key_method identifier id'>key_method</span> <span class='assign token'>=</span> <span class='dstring node'>&quot;#{method}_key&quot;</span><span class='dot token'>.</span><span class='to_sym identifier id'>to_sym</span>
815
+ <span class='key identifier id'>key</span> <span class='assign token'>=</span> <span class='caller_object identifier id'>caller_object</span><span class='dot token'>.</span><span class='send identifier id'>send</span> <span class='key_method identifier id'>key_method</span><span class='comma token'>,</span> <span class='mult op'>*</span><span class='args identifier id'>args</span> <span class='if if_mod kw'>if</span> <span class='caller_object identifier id'>caller_object</span><span class='dot token'>.</span><span class='respond_to? fid id'>respond_to?</span> <span class='key_method identifier id'>key_method</span>
816
+ <span class='key identifier id'>key</span> <span class='opasgn op'>||=</span> <span class='caller_object identifier id'>caller_object</span><span class='dot token'>.</span><span class='build_key identifier id'>build_key</span><span class='lparen token'>(</span><span class='symbol val'>:name</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='method identifier id'>method</span><span class='comma token'>,</span> <span class='symbol val'>:args</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='args identifier id'>args</span><span class='rparen token'>)</span>
817
+ <span class='end end kw'>end</span>
818
+ </pre>
819
+ </td>
820
+ </tr>
821
+ </table>
822
+ </div>
823
+
824
+ </div>
825
+
826
+ </div>
827
+
828
+ <div id="footer">
829
+ Generated on Sun Aug 7 21:40:15 2011 by
830
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
831
+ 0.7.2 (ruby-1.8.7).
832
+ </div>
833
+
834
+ </body>
835
+ </html>