elephas 1.1.3 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +1 -1
- data/Gemfile +1 -1
- data/README.md +4 -2
- data/Rakefile +1 -1
- data/doc/Elephas/Cache.html +83 -63
- data/doc/Elephas/Entry.html +897 -59
- data/doc/Elephas/Providers/Base.html +31 -78
- data/doc/Elephas/Providers/Hash.html +137 -23
- data/doc/Elephas/Providers/RubyOnRails.html +20 -21
- data/doc/Elephas/Providers.html +3 -3
- data/doc/Elephas/Version.html +6 -6
- data/doc/Elephas.html +4 -4
- data/doc/_index.html +4 -4
- data/doc/file.README.html +8 -6
- data/doc/frames.html +1 -1
- data/doc/index.html +8 -6
- data/doc/top-level-namespace.html +3 -3
- data/elephas.gemspec +10 -8
- data/lib/elephas/cache.rb +124 -103
- data/lib/elephas/entry.rb +23 -22
- data/lib/elephas/provider.rb +13 -5
- data/lib/elephas/providers/hash.rb +14 -14
- data/lib/elephas/providers/ruby_on_rails.rb +10 -11
- data/lib/elephas/version.rb +4 -4
- data/lib/elephas.rb +1 -3
- data/locales/en.yml +9 -0
- data/locales/it.yml +9 -0
- data/spec/coverage_helper.rb +1 -1
- data/spec/elephas/cache_spec.rb +19 -19
- data/spec/elephas/entry_spec.rb +1 -1
- data/spec/elephas/provider_spec.rb +1 -1
- data/spec/elephas/providers/hash_spec.rb +3 -3
- data/spec/elephas/providers/ruby_on_rails_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -1
- metadata +18 -23
- data/doc/Elephas/Exceptions.html +0 -115
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<title>
|
|
7
7
|
Module: Elephas::Providers::Base
|
|
8
8
|
|
|
9
|
-
— Documentation by YARD 0.8.
|
|
9
|
+
— Documentation by YARD 0.8.3
|
|
10
10
|
|
|
11
11
|
</title>
|
|
12
12
|
|
|
@@ -79,15 +79,19 @@
|
|
|
79
79
|
|
|
80
80
|
|
|
81
81
|
|
|
82
|
+
<dt class="r2">Includes:</dt>
|
|
83
|
+
<dd class="r2">Lazier::I18n</dd>
|
|
84
|
+
|
|
85
|
+
|
|
82
86
|
|
|
83
87
|
|
|
84
|
-
<dt class="
|
|
85
|
-
<dd class="
|
|
88
|
+
<dt class="r1">Included in:</dt>
|
|
89
|
+
<dd class="r1"><span class='object_link'><a href="Hash.html" title="Elephas::Providers::Hash (class)">Hash</a></span>, <span class='object_link'><a href="RubyOnRails.html" title="Elephas::Providers::RubyOnRails (class)">RubyOnRails</a></span></dd>
|
|
86
90
|
|
|
87
91
|
|
|
88
92
|
|
|
89
|
-
<dt class="
|
|
90
|
-
<dd class="
|
|
93
|
+
<dt class="r2 last">Defined in:</dt>
|
|
94
|
+
<dd class="r2 last">lib/elephas/provider.rb</dd>
|
|
91
95
|
|
|
92
96
|
</dl>
|
|
93
97
|
<div class="clear"></div>
|
|
@@ -237,6 +241,7 @@
|
|
|
237
241
|
|
|
238
242
|
|
|
239
243
|
|
|
244
|
+
|
|
240
245
|
|
|
241
246
|
<div id="instance_method_details" class="method_details_list">
|
|
242
247
|
<h2>Instance Method Details</h2>
|
|
@@ -293,19 +298,6 @@
|
|
|
293
298
|
<div class='inline'><p><code>true</code> if the key was in the cache, <code>false</code> otherwise.</p>
|
|
294
299
|
</div>
|
|
295
300
|
|
|
296
|
-
</li>
|
|
297
|
-
|
|
298
|
-
</ul>
|
|
299
|
-
<p class="tag_title">Raises:</p>
|
|
300
|
-
<ul class="raise">
|
|
301
|
-
|
|
302
|
-
<li>
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
<span class='type'>(<tt>ArgumentError</tt>)</span>
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
301
|
</li>
|
|
310
302
|
|
|
311
303
|
</ul>
|
|
@@ -316,15 +308,15 @@
|
|
|
316
308
|
<pre class="lines">
|
|
317
309
|
|
|
318
310
|
|
|
319
|
-
38
|
|
320
311
|
39
|
|
321
|
-
40
|
|
312
|
+
40
|
|
313
|
+
41</pre>
|
|
322
314
|
</td>
|
|
323
315
|
<td>
|
|
324
|
-
<pre class="code"><span class="info file"># File 'lib/elephas/provider.rb', line
|
|
316
|
+
<pre class="code"><span class="info file"># File 'lib/elephas/provider.rb', line 39</span>
|
|
325
317
|
|
|
326
318
|
<span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
|
327
|
-
<span class='id identifier
|
|
319
|
+
<span class='id identifier rubyid_unimplemented'>unimplemented</span>
|
|
328
320
|
<span class='kw'>end</span></pre>
|
|
329
321
|
</td>
|
|
330
322
|
</tr>
|
|
@@ -382,19 +374,6 @@
|
|
|
382
374
|
<div class='inline'><p><code>true</code> if the key is in the cache, <code>false</code> otherwise.</p>
|
|
383
375
|
</div>
|
|
384
376
|
|
|
385
|
-
</li>
|
|
386
|
-
|
|
387
|
-
</ul>
|
|
388
|
-
<p class="tag_title">Raises:</p>
|
|
389
|
-
<ul class="raise">
|
|
390
|
-
|
|
391
|
-
<li>
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
<span class='type'>(<tt>ArgumentError</tt>)</span>
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
377
|
</li>
|
|
399
378
|
|
|
400
379
|
</ul>
|
|
@@ -405,15 +384,15 @@
|
|
|
405
384
|
<pre class="lines">
|
|
406
385
|
|
|
407
386
|
|
|
408
|
-
46
|
|
409
387
|
47
|
|
410
|
-
48
|
|
388
|
+
48
|
|
389
|
+
49</pre>
|
|
411
390
|
</td>
|
|
412
391
|
<td>
|
|
413
|
-
<pre class="code"><span class="info file"># File 'lib/elephas/provider.rb', line
|
|
392
|
+
<pre class="code"><span class="info file"># File 'lib/elephas/provider.rb', line 47</span>
|
|
414
393
|
|
|
415
394
|
<span class='kw'>def</span> <span class='id identifier rubyid_exists?'>exists?</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
|
416
|
-
<span class='id identifier
|
|
395
|
+
<span class='id identifier rubyid_unimplemented'>unimplemented</span>
|
|
417
396
|
<span class='kw'>end</span></pre>
|
|
418
397
|
</td>
|
|
419
398
|
</tr>
|
|
@@ -462,12 +441,12 @@
|
|
|
462
441
|
<pre class="lines">
|
|
463
442
|
|
|
464
443
|
|
|
465
|
-
53
|
|
466
444
|
54
|
|
467
|
-
55
|
|
445
|
+
55
|
|
446
|
+
56</pre>
|
|
468
447
|
</td>
|
|
469
448
|
<td>
|
|
470
|
-
<pre class="code"><span class="info file"># File 'lib/elephas/provider.rb', line
|
|
449
|
+
<pre class="code"><span class="info file"># File 'lib/elephas/provider.rb', line 54</span>
|
|
471
450
|
|
|
472
451
|
<span class='kw'>def</span> <span class='id identifier rubyid_now'>now</span>
|
|
473
452
|
<span class='op'>::</span><span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='period'>.</span><span class='id identifier rubyid_to_f'>to_f</span>
|
|
@@ -528,19 +507,6 @@
|
|
|
528
507
|
<div class='inline'><p>The read value or <code>nil</code>.</p>
|
|
529
508
|
</div>
|
|
530
509
|
|
|
531
|
-
</li>
|
|
532
|
-
|
|
533
|
-
</ul>
|
|
534
|
-
<p class="tag_title">Raises:</p>
|
|
535
|
-
<ul class="raise">
|
|
536
|
-
|
|
537
|
-
<li>
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
<span class='type'>(<tt>ArgumentError</tt>)</span>
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
510
|
</li>
|
|
545
511
|
|
|
546
512
|
</ul>
|
|
@@ -551,15 +517,15 @@
|
|
|
551
517
|
<pre class="lines">
|
|
552
518
|
|
|
553
519
|
|
|
554
|
-
19
|
|
555
520
|
20
|
|
556
|
-
21
|
|
521
|
+
21
|
|
522
|
+
22</pre>
|
|
557
523
|
</td>
|
|
558
524
|
<td>
|
|
559
|
-
<pre class="code"><span class="info file"># File 'lib/elephas/provider.rb', line
|
|
525
|
+
<pre class="code"><span class="info file"># File 'lib/elephas/provider.rb', line 20</span>
|
|
560
526
|
|
|
561
527
|
<span class='kw'>def</span> <span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
|
562
|
-
<span class='id identifier
|
|
528
|
+
<span class='id identifier rubyid_unimplemented'>unimplemented</span>
|
|
563
529
|
<span class='kw'>end</span></pre>
|
|
564
530
|
</td>
|
|
565
531
|
</tr>
|
|
@@ -649,19 +615,6 @@
|
|
|
649
615
|
<div class='inline'><p>The value itself.</p>
|
|
650
616
|
</div>
|
|
651
617
|
|
|
652
|
-
</li>
|
|
653
|
-
|
|
654
|
-
</ul>
|
|
655
|
-
<p class="tag_title">Raises:</p>
|
|
656
|
-
<ul class="raise">
|
|
657
|
-
|
|
658
|
-
<li>
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
<span class='type'>(<tt>ArgumentError</tt>)</span>
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
618
|
</li>
|
|
666
619
|
|
|
667
620
|
</ul>
|
|
@@ -679,15 +632,15 @@
|
|
|
679
632
|
<pre class="lines">
|
|
680
633
|
|
|
681
634
|
|
|
682
|
-
30
|
|
683
635
|
31
|
|
684
|
-
32
|
|
636
|
+
32
|
|
637
|
+
33</pre>
|
|
685
638
|
</td>
|
|
686
639
|
<td>
|
|
687
|
-
<pre class="code"><span class="info file"># File 'lib/elephas/provider.rb', line
|
|
640
|
+
<pre class="code"><span class="info file"># File 'lib/elephas/provider.rb', line 31</span>
|
|
688
641
|
|
|
689
642
|
<span class='kw'>def</span> <span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
|
690
|
-
<span class='id identifier
|
|
643
|
+
<span class='id identifier rubyid_unimplemented'>unimplemented</span>
|
|
691
644
|
<span class='kw'>end</span></pre>
|
|
692
645
|
</td>
|
|
693
646
|
</tr>
|
|
@@ -699,9 +652,9 @@
|
|
|
699
652
|
</div>
|
|
700
653
|
|
|
701
654
|
<div id="footer">
|
|
702
|
-
Generated on
|
|
655
|
+
Generated on Sat Feb 2 09:15:15 2013 by
|
|
703
656
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
704
|
-
0.8.
|
|
657
|
+
0.8.3 (ruby-1.9.3).
|
|
705
658
|
</div>
|
|
706
659
|
|
|
707
660
|
</body>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<title>
|
|
7
7
|
Class: Elephas::Providers::Hash
|
|
8
8
|
|
|
9
|
-
— Documentation by YARD 0.8.
|
|
9
|
+
— Documentation by YARD 0.8.3
|
|
10
10
|
|
|
11
11
|
</title>
|
|
12
12
|
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
<li class="public ">
|
|
124
124
|
<span class="summary_signature">
|
|
125
125
|
|
|
126
|
-
<a href="#data-instance_method" title="#data (instance method)">- (
|
|
126
|
+
<a href="#data-instance_method" title="#data (instance method)">- (Hash) <strong>data</strong> </a>
|
|
127
127
|
|
|
128
128
|
|
|
129
129
|
|
|
@@ -291,6 +291,7 @@
|
|
|
291
291
|
<h3 class="inherited">Methods included from <span class='object_link'><a href="Base.html" title="Elephas::Providers::Base (module)">Base</a></span></h3>
|
|
292
292
|
<p class="inherited"><span class='object_link'><a href="Base.html#now-instance_method" title="Elephas::Providers::Base#now (method)">#now</a></span></p>
|
|
293
293
|
|
|
294
|
+
|
|
294
295
|
<div id="constructor_details" class="method_details_list">
|
|
295
296
|
<h2>Constructor Details</h2>
|
|
296
297
|
|
|
@@ -340,17 +341,15 @@
|
|
|
340
341
|
<pre class="lines">
|
|
341
342
|
|
|
342
343
|
|
|
343
|
-
18
|
|
344
344
|
19
|
|
345
345
|
20
|
|
346
346
|
21</pre>
|
|
347
347
|
</td>
|
|
348
348
|
<td>
|
|
349
|
-
<pre class="code"><span class="info file"># File 'lib/elephas/providers/hash.rb', line
|
|
349
|
+
<pre class="code"><span class="info file"># File 'lib/elephas/providers/hash.rb', line 19</span>
|
|
350
350
|
|
|
351
351
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
|
352
|
-
<span class='
|
|
353
|
-
<span class='ivar'>@data</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span>
|
|
352
|
+
<span class='ivar'>@data</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span> <span class='op'>&&</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_data'>data</span> <span class='op'>:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
|
354
353
|
<span class='kw'>end</span></pre>
|
|
355
354
|
</td>
|
|
356
355
|
</tr>
|
|
@@ -367,7 +366,7 @@
|
|
|
367
366
|
<div class="method_details first">
|
|
368
367
|
<h3 class="signature first" id="data-instance_method">
|
|
369
368
|
|
|
370
|
-
- (<tt>
|
|
369
|
+
- (<tt><span class='object_link'><a href="" title="Elephas::Providers::Hash (class)">Hash</a></span></tt>) <strong>data</strong>
|
|
371
370
|
|
|
372
371
|
|
|
373
372
|
|
|
@@ -382,6 +381,23 @@
|
|
|
382
381
|
</div>
|
|
383
382
|
<div class="tags">
|
|
384
383
|
|
|
384
|
+
<p class="tag_title">Returns:</p>
|
|
385
|
+
<ul class="return">
|
|
386
|
+
|
|
387
|
+
<li>
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="Elephas::Providers::Hash (class)">Hash</a></span></tt>)</span>
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
—
|
|
395
|
+
<div class='inline'><p>The internal hash used by the provider.</p>
|
|
396
|
+
</div>
|
|
397
|
+
|
|
398
|
+
</li>
|
|
399
|
+
|
|
400
|
+
</ul>
|
|
385
401
|
|
|
386
402
|
</div><table class="source_code">
|
|
387
403
|
<tr>
|
|
@@ -389,15 +405,113 @@
|
|
|
389
405
|
<pre class="lines">
|
|
390
406
|
|
|
391
407
|
|
|
408
|
+
13
|
|
392
409
|
14
|
|
393
410
|
15
|
|
394
|
-
16
|
|
411
|
+
16
|
|
412
|
+
17
|
|
413
|
+
18
|
|
414
|
+
19
|
|
415
|
+
20
|
|
416
|
+
21
|
|
417
|
+
22
|
|
418
|
+
23
|
|
419
|
+
24
|
|
420
|
+
25
|
|
421
|
+
26
|
|
422
|
+
27
|
|
423
|
+
28
|
|
424
|
+
29
|
|
425
|
+
30
|
|
426
|
+
31
|
|
427
|
+
32
|
|
428
|
+
33
|
|
429
|
+
34
|
|
430
|
+
35
|
|
431
|
+
36
|
|
432
|
+
37
|
|
433
|
+
38
|
|
434
|
+
39
|
|
435
|
+
40
|
|
436
|
+
41
|
|
437
|
+
42
|
|
438
|
+
43
|
|
439
|
+
44
|
|
440
|
+
45
|
|
441
|
+
46
|
|
442
|
+
47
|
|
443
|
+
48
|
|
444
|
+
49
|
|
445
|
+
50
|
|
446
|
+
51
|
|
447
|
+
52
|
|
448
|
+
53
|
|
449
|
+
54
|
|
450
|
+
55
|
|
451
|
+
56
|
|
452
|
+
57
|
|
453
|
+
58
|
|
454
|
+
59
|
|
455
|
+
60
|
|
456
|
+
61
|
|
457
|
+
62
|
|
458
|
+
63
|
|
459
|
+
64</pre>
|
|
395
460
|
</td>
|
|
396
461
|
<td>
|
|
397
|
-
<pre class="code"><span class="info file"># File 'lib/elephas/providers/hash.rb', line
|
|
398
|
-
|
|
399
|
-
<span class='kw'>
|
|
400
|
-
<span class='
|
|
462
|
+
<pre class="code"><span class="info file"># File 'lib/elephas/providers/hash.rb', line 13</span>
|
|
463
|
+
|
|
464
|
+
<span class='kw'>class</span> <span class='const'>Hash</span>
|
|
465
|
+
<span class='id identifier rubyid_include'>include</span> <span class='const'>Elephas</span><span class='op'>::</span><span class='const'>Providers</span><span class='op'>::</span><span class='const'>Base</span>
|
|
466
|
+
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:data</span>
|
|
467
|
+
|
|
468
|
+
<span class='comment'># Initialize the provider
|
|
469
|
+
</span> <span class='comment'># @param data [Hash] The initial data stored.
|
|
470
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
|
471
|
+
<span class='ivar'>@data</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span> <span class='op'>&&</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Hash</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_data'>data</span> <span class='op'>:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
|
472
|
+
<span class='kw'>end</span>
|
|
473
|
+
|
|
474
|
+
<span class='comment'># Reads a value from the cache.
|
|
475
|
+
</span> <span class='comment'>#
|
|
476
|
+
</span> <span class='comment'># @param key [String] The key to lookup.
|
|
477
|
+
</span> <span class='comment'># @return [Entry|NilClass] The read value or `nil`.
|
|
478
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
|
479
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_exists?'>exists?</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='ivar'>@data</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='rbracket'>]</span> <span class='op'>:</span> <span class='kw'>nil</span>
|
|
480
|
+
<span class='kw'>end</span>
|
|
481
|
+
|
|
482
|
+
<span class='comment'># Writes a value to the cache.
|
|
483
|
+
</span> <span class='comment'>#
|
|
484
|
+
</span> <span class='comment'># @param key [String] The key to associate the value with.
|
|
485
|
+
</span> <span class='comment'># @param value [Object] The value to write. Setting a value to `nil` **doesn't** mean *deleting* the value.
|
|
486
|
+
</span> <span class='comment'># @param options [Hash] A list of options for writing.
|
|
487
|
+
</span> <span class='comment'># @see Elephas::Cache.setup_options
|
|
488
|
+
</span> <span class='comment'># @return [Object] The value itself.
|
|
489
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
|
490
|
+
<span class='id identifier rubyid_entry'>entry</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Elephas</span><span class='op'>::</span><span class='const'>Entry</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
|
491
|
+
<span class='id identifier rubyid_entry'>entry</span><span class='period'>.</span><span class='id identifier rubyid_refresh'>refresh</span>
|
|
492
|
+
<span class='ivar'>@data</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_entry'>entry</span>
|
|
493
|
+
<span class='id identifier rubyid_entry'>entry</span>
|
|
494
|
+
<span class='kw'>end</span>
|
|
495
|
+
|
|
496
|
+
<span class='comment'># Deletes a value from the cache.
|
|
497
|
+
</span> <span class='comment'>#
|
|
498
|
+
</span> <span class='comment'># @param key [String] The key to delete.
|
|
499
|
+
</span> <span class='comment'># @return [Boolean] `true` if the key was in the cache, `false` otherwise.
|
|
500
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
|
501
|
+
<span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
|
502
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
|
503
|
+
<span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
|
504
|
+
<span class='id identifier rubyid_rv'>rv</span>
|
|
505
|
+
<span class='kw'>end</span>
|
|
506
|
+
|
|
507
|
+
<span class='comment'># Checks if a key exists in the cache.
|
|
508
|
+
</span> <span class='comment'>#
|
|
509
|
+
</span> <span class='comment'># @param key [String] The key to lookup.
|
|
510
|
+
</span> <span class='comment'># @return [Boolean] `true` if the key is in the cache, `false` otherwise.
|
|
511
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_exists?'>exists?</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
|
512
|
+
<span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
|
513
|
+
<span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='ivar'>@data</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_valid?'>valid?</span>
|
|
514
|
+
<span class='kw'>end</span>
|
|
401
515
|
<span class='kw'>end</span></pre>
|
|
402
516
|
</td>
|
|
403
517
|
</tr>
|
|
@@ -483,9 +597,9 @@
|
|
|
483
597
|
<pre class="code"><span class="info file"># File 'lib/elephas/providers/hash.rb', line 49</span>
|
|
484
598
|
|
|
485
599
|
<span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
|
486
|
-
<span class='id identifier
|
|
487
|
-
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='id identifier
|
|
488
|
-
<span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier
|
|
600
|
+
<span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
|
601
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
|
602
|
+
<span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
|
489
603
|
<span class='id identifier rubyid_rv'>rv</span>
|
|
490
604
|
<span class='kw'>end</span></pre>
|
|
491
605
|
</td>
|
|
@@ -563,8 +677,8 @@
|
|
|
563
677
|
<pre class="code"><span class="info file"># File 'lib/elephas/providers/hash.rb', line 60</span>
|
|
564
678
|
|
|
565
679
|
<span class='kw'>def</span> <span class='id identifier rubyid_exists?'>exists?</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
|
566
|
-
<span class='id identifier
|
|
567
|
-
<span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='id identifier
|
|
680
|
+
<span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
|
681
|
+
<span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='ivar'>@data</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_valid?'>valid?</span>
|
|
568
682
|
<span class='kw'>end</span></pre>
|
|
569
683
|
</td>
|
|
570
684
|
</tr>
|
|
@@ -758,10 +872,10 @@
|
|
|
758
872
|
<pre class="code"><span class="info file"># File 'lib/elephas/providers/hash.rb', line 38</span>
|
|
759
873
|
|
|
760
874
|
<span class='kw'>def</span> <span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
|
761
|
-
<span class='id identifier
|
|
762
|
-
<span class='id identifier
|
|
763
|
-
<span class='ivar'>@data</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier
|
|
764
|
-
<span class='id identifier
|
|
875
|
+
<span class='id identifier rubyid_entry'>entry</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Elephas</span><span class='op'>::</span><span class='const'>Entry</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
|
876
|
+
<span class='id identifier rubyid_entry'>entry</span><span class='period'>.</span><span class='id identifier rubyid_refresh'>refresh</span>
|
|
877
|
+
<span class='ivar'>@data</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_entry'>entry</span>
|
|
878
|
+
<span class='id identifier rubyid_entry'>entry</span>
|
|
765
879
|
<span class='kw'>end</span></pre>
|
|
766
880
|
</td>
|
|
767
881
|
</tr>
|
|
@@ -773,9 +887,9 @@
|
|
|
773
887
|
</div>
|
|
774
888
|
|
|
775
889
|
<div id="footer">
|
|
776
|
-
Generated on
|
|
890
|
+
Generated on Sat Feb 2 09:15:15 2013 by
|
|
777
891
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
778
|
-
0.8.
|
|
892
|
+
0.8.3 (ruby-1.9.3).
|
|
779
893
|
</div>
|
|
780
894
|
|
|
781
895
|
</body>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<title>
|
|
7
7
|
Class: Elephas::Providers::RubyOnRails
|
|
8
8
|
|
|
9
|
-
— Documentation by YARD 0.8.
|
|
9
|
+
— Documentation by YARD 0.8.3
|
|
10
10
|
|
|
11
11
|
</title>
|
|
12
12
|
|
|
@@ -236,6 +236,7 @@
|
|
|
236
236
|
<p class="inherited"><span class='object_link'><a href="Base.html#now-instance_method" title="Elephas::Providers::Base#now (method)">#now</a></span></p>
|
|
237
237
|
|
|
238
238
|
|
|
239
|
+
|
|
239
240
|
|
|
240
241
|
<div id="instance_method_details" class="method_details_list">
|
|
241
242
|
<h2>Instance Method Details</h2>
|
|
@@ -302,20 +303,20 @@
|
|
|
302
303
|
<pre class="lines">
|
|
303
304
|
|
|
304
305
|
|
|
306
|
+
39
|
|
305
307
|
40
|
|
306
308
|
41
|
|
307
309
|
42
|
|
308
310
|
43
|
|
309
|
-
44
|
|
310
|
-
45</pre>
|
|
311
|
+
44</pre>
|
|
311
312
|
</td>
|
|
312
313
|
<td>
|
|
313
|
-
<pre class="code"><span class="info file"># File 'lib/elephas/providers/ruby_on_rails.rb', line
|
|
314
|
+
<pre class="code"><span class="info file"># File 'lib/elephas/providers/ruby_on_rails.rb', line 39</span>
|
|
314
315
|
|
|
315
316
|
<span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
|
316
|
-
<span class='id identifier
|
|
317
|
-
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_cache'>cache</span><span class='period'>.</span><span class='id identifier rubyid_exist?'>exist?</span><span class='lparen'>(</span><span class='id identifier
|
|
318
|
-
<span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_cache'>cache</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier
|
|
317
|
+
<span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
|
318
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_cache'>cache</span><span class='period'>.</span><span class='id identifier rubyid_exist?'>exist?</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
|
319
|
+
<span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_cache'>cache</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
|
319
320
|
<span class='id identifier rubyid_rv'>rv</span>
|
|
320
321
|
<span class='kw'>end</span></pre>
|
|
321
322
|
</td>
|
|
@@ -384,17 +385,17 @@
|
|
|
384
385
|
<pre class="lines">
|
|
385
386
|
|
|
386
387
|
|
|
388
|
+
50
|
|
387
389
|
51
|
|
388
390
|
52
|
|
389
|
-
53
|
|
390
|
-
54</pre>
|
|
391
|
+
53</pre>
|
|
391
392
|
</td>
|
|
392
393
|
<td>
|
|
393
|
-
<pre class="code"><span class="info file"># File 'lib/elephas/providers/ruby_on_rails.rb', line
|
|
394
|
+
<pre class="code"><span class="info file"># File 'lib/elephas/providers/ruby_on_rails.rb', line 50</span>
|
|
394
395
|
|
|
395
396
|
<span class='kw'>def</span> <span class='id identifier rubyid_exists?'>exists?</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
|
396
|
-
<span class='id identifier
|
|
397
|
-
<span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_cache'>cache</span><span class='period'>.</span><span class='id identifier rubyid_exist?'>exist?</span><span class='lparen'>(</span><span class='id identifier
|
|
397
|
+
<span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
|
398
|
+
<span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_cache'>cache</span><span class='period'>.</span><span class='id identifier rubyid_exist?'>exist?</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_cache'>cache</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_valid?'>valid?</span>
|
|
398
399
|
<span class='kw'>end</span></pre>
|
|
399
400
|
</td>
|
|
400
401
|
</tr>
|
|
@@ -582,18 +583,16 @@
|
|
|
582
583
|
30
|
|
583
584
|
31
|
|
584
585
|
32
|
|
585
|
-
33
|
|
586
|
-
34</pre>
|
|
586
|
+
33</pre>
|
|
587
587
|
</td>
|
|
588
588
|
<td>
|
|
589
589
|
<pre class="code"><span class="info file"># File 'lib/elephas/providers/ruby_on_rails.rb', line 28</span>
|
|
590
590
|
|
|
591
591
|
<span class='kw'>def</span> <span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
|
592
|
-
<span class='id identifier
|
|
593
|
-
<span class='id identifier
|
|
594
|
-
|
|
595
|
-
<span class='
|
|
596
|
-
<span class='id identifier rubyid_value'>value</span>
|
|
592
|
+
<span class='id identifier rubyid_entry'>entry</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Elephas</span><span class='op'>::</span><span class='const'>Entry</span><span class='period'>.</span><span class='id identifier rubyid_ensure'>ensure</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
|
593
|
+
<span class='id identifier rubyid_entry'>entry</span><span class='period'>.</span><span class='id identifier rubyid_refresh'>refresh</span>
|
|
594
|
+
<span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_cache'>cache</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_entry'>entry</span><span class='comma'>,</span> <span class='label'>expires_in:</span> <span class='id identifier rubyid_entry'>entry</span><span class='period'>.</span><span class='id identifier rubyid_ttl'>ttl</span><span class='rparen'>)</span>
|
|
595
|
+
<span class='id identifier rubyid_entry'>entry</span>
|
|
597
596
|
<span class='kw'>end</span></pre>
|
|
598
597
|
</td>
|
|
599
598
|
</tr>
|
|
@@ -605,9 +604,9 @@
|
|
|
605
604
|
</div>
|
|
606
605
|
|
|
607
606
|
<div id="footer">
|
|
608
|
-
Generated on
|
|
607
|
+
Generated on Sat Feb 2 09:15:15 2013 by
|
|
609
608
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
610
|
-
0.8.
|
|
609
|
+
0.8.3 (ruby-1.9.3).
|
|
611
610
|
</div>
|
|
612
611
|
|
|
613
612
|
</body>
|
data/doc/Elephas/Providers.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<title>
|
|
7
7
|
Module: Elephas::Providers
|
|
8
8
|
|
|
9
|
-
— Documentation by YARD 0.8.
|
|
9
|
+
— Documentation by YARD 0.8.3
|
|
10
10
|
|
|
11
11
|
</title>
|
|
12
12
|
|
|
@@ -120,9 +120,9 @@
|
|
|
120
120
|
</div>
|
|
121
121
|
|
|
122
122
|
<div id="footer">
|
|
123
|
-
Generated on
|
|
123
|
+
Generated on Sat Feb 2 09:15:15 2013 by
|
|
124
124
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
125
|
-
0.8.
|
|
125
|
+
0.8.3 (ruby-1.9.3).
|
|
126
126
|
</div>
|
|
127
127
|
|
|
128
128
|
</body>
|