elephas 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -16,5 +16,5 @@ gem "rake", "~> 10.0.3"
16
16
  gem "simplecov", ">= 0.7.1"
17
17
  gem "pry", ">= 0"
18
18
  gem "yard", ">= 0.8.4"
19
- gem "redcarpet", ">= 2.2.2"
19
+ gem "kramdown", ">= 0.14.2"
20
20
  gem "github-markup", ">= 0.7.5"
data/Rakefile CHANGED
@@ -8,11 +8,4 @@ require "bundler/gem_tasks"
8
8
  require "rspec/core/rake_task"
9
9
 
10
10
  RSpec::Core::RakeTask.new("spec")
11
-
12
- namespace :spec do
13
- desc "Run all specs with coverage"
14
- task :coverage do
15
- ENV["ELEPHAS_COVERAGE"] = "TRUE"
16
- Rake::Task["spec"].invoke
17
- end
18
- end
11
+ RSpec::Core::RakeTask.new("spec:coverage") { |t| t.ruby_opts = "-r./spec/coverage_helper" }
@@ -672,13 +672,13 @@
672
672
  Valid options are:</p>
673
673
 
674
674
  <ul>
675
- <li><strong>:ttl</strong>: The TTL (time to live, in milliseconds) of the entry. It means how long will the value stay in cache. Setting it to 0 or less means never cache the entry.</li>
676
- <li><strong>:force</strong>: Setting it to <code>true</code> will always skip the cache.</li>
677
- <li><strong>:key</strong>: The key associated to this value. <strong>You should never set this option directly.</strong></li>
678
- <li><strong>:prefix</strong>: The prefix used in cache. This is used to avoid conflicts with other caching frameworks.</li>
679
- <li><strong>:complete_key</strong>: The complete key used for computing the hash. By default is concatenation of <code>:key</code> and <code>:prefix</code> options.</li>
680
- <li><strong>:hash</strong>: The hash used to store the key in the cache. Should be unique</li>
681
- <li><strong>:as_entry</strong>: In <code>Elephas::Cache.use</code>, setting this to <code>true</code> will return the entire <code>Entry</code> object rather than the value only.</li>
675
+ <li><strong>:ttl</strong>: The TTL (time to live, in milliseconds) of the entry. It means how long will the value stay in cache. Setting it to 0 or less means never cache the entry.</li>
676
+ <li><strong>:force</strong>: Setting it to <code>true</code> will always skip the cache.</li>
677
+ <li><strong>:key</strong>: The key associated to this value. <strong>You should never set this option directly.</strong></li>
678
+ <li><strong>:prefix</strong>: The prefix used in cache. This is used to avoid conflicts with other caching frameworks.</li>
679
+ <li><strong>:complete_key</strong>: The complete key used for computing the hash. By default is concatenation of <code>:key</code> and <code>:prefix</code> options.</li>
680
+ <li><strong>:hash</strong>: The hash used to store the key in the cache. Should be unique</li>
681
+ <li><strong>:as_entry</strong>: In <code>Elephas::Cache.use</code>, setting this to <code>true</code> will return the entire <code>Entry</code> object rather than the value only.</li>
682
682
  </ul>
683
683
 
684
684
 
@@ -798,22 +798,23 @@ Valid options are:</p>
798
798
 
799
799
  <p>It tries reading a key from the cache.</p>
800
800
 
801
- <p>If it doesn&#39;t find it, it uses the provided block (which receives options as argument) to compute its value and then store it into the cache for later usages.</p>
801
+ <p>If it doesn&#8217;t find it, it uses the provided block (which receives options as argument) to compute its value and then store it into the cache for later usages.</p>
802
802
 
803
- <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='const'>Elephas</span><span class='op'>::</span><span class='const'>Cache</span><span class='period'>.</span><span class='id identifier rubyid_use'>use</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>KEY</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_options'>options</span><span class='op'>|</span>
804
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>VALUE</span><span class='tstring_end'>&quot;</span></span>
805
- <span class='kw'>end</span>
803
+ <p>```ruby
804
+ value = Elephas::Cache.use(&#8220;KEY&#8221;) do |options|
805
+ &#8220;VALUE&#8221;
806
+ end</p>
806
807
 
807
- <span class='id identifier rubyid_value'>value</span>
808
- <span class='comment'># =&gt; &quot;VALUE&quot;
809
- </span>
810
- <span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='const'>Elephas</span><span class='op'>::</span><span class='const'>Cache</span><span class='period'>.</span><span class='id identifier rubyid_use'>use</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>KEY</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_options'>options</span><span class='op'>|</span>
811
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>ANOTHER VALUE</span><span class='tstring_end'>&quot;</span></span>
812
- <span class='kw'>end</span>
808
+ <p>value
809
+ # =&gt; &#8220;VALUE&#8221;</p>
810
+
811
+ <p>value = Elephas::Cache.use(&#8220;KEY&#8221;) do |options|
812
+ &#8220;ANOTHER VALUE&#8221;
813
+ end</p>
813
814
 
814
- <span class='id identifier rubyid_value'>value</span>
815
- <span class='comment'># =&gt; &quot;VALUE&quot;
816
- </span></code></pre>
815
+ <p>value
816
+ # =&gt; &#8220;VALUE&#8221;
817
+ ```</p>
817
818
 
818
819
 
819
820
  </div>
@@ -982,7 +983,7 @@ Valid options are:</p>
982
983
 
983
984
 
984
985
  &mdash;
985
- <div class='inline'><p>The value to write. Setting a value to <code>nil</code> <strong>doesn&#39;t</strong> mean <em>deleting</em> the value.</p>
986
+ <div class='inline'><p>The value to write. Setting a value to <code>nil</code> <strong>doesnt</strong> mean <em>deleting</em> the value.</p>
986
987
  </div>
987
988
 
988
989
  </li>
@@ -1057,7 +1058,7 @@ Valid options are:</p>
1057
1058
  </div>
1058
1059
 
1059
1060
  <div id="footer">
1060
- Generated on Thu Feb 7 08:33:46 2013 by
1061
+ Generated on Thu Feb 7 21:28:09 2013 by
1061
1062
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1062
1063
  0.8.4.1 (ruby-1.9.3).
1063
1064
  </div>
@@ -655,7 +655,18 @@
655
655
  93
656
656
  94
657
657
  95
658
- 96</pre>
658
+ 96
659
+ 97
660
+ 98
661
+ 99
662
+ 100
663
+ 101
664
+ 102
665
+ 103
666
+ 104
667
+ 105
668
+ 106
669
+ 107</pre>
659
670
  </td>
660
671
  <td>
661
672
  <pre class="code"><span class="info file"># File 'lib/elephas/entry.rb', line 20</span>
@@ -686,7 +697,7 @@
686
697
  </span> <span class='comment'># @param save [Boolean] If to save the refresh value in the cache.
687
698
  </span> <span class='comment'># @return [Float] The new updated_at value.
688
699
  </span> <span class='kw'>def</span> <span class='id identifier rubyid_refresh'>refresh</span><span class='lparen'>(</span><span class='id identifier rubyid_save'>save</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
689
- <span class='ivar'>@updated_at</span> <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>
700
+ <span class='ivar'>@updated_at</span> <span class='op'>=</span> <span class='id identifier rubyid_get_new_updated_at'>get_new_updated_at</span><span class='lparen'>(</span><span class='ivar'>@updated_at</span><span class='rparen'>)</span>
690
701
  <span class='const'>Elephas</span><span class='op'>::</span><span class='const'>Cache</span><span class='period'>.</span><span class='id identifier rubyid_provider'>provider</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='ivar'>@hash</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_save'>save</span>
691
702
  <span class='ivar'>@updated_at</span>
692
703
  <span class='kw'>end</span>
@@ -736,6 +747,17 @@
736
747
 
737
748
  <span class='id identifier rubyid_rv'>rv</span>
738
749
  <span class='kw'>end</span>
750
+
751
+ <span class='id identifier rubyid_private'>private</span>
752
+ <span class='comment'># Makes sure a new updated at is generated.
753
+ </span> <span class='comment'>#
754
+ </span> <span class='comment'># @param initial [Float] Old value.
755
+ </span> <span class='comment'># @return [Float] New value.
756
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_get_new_updated_at'>get_new_updated_at</span><span class='lparen'>(</span><span class='id identifier rubyid_initial'>initial</span><span class='rparen'>)</span>
757
+ <span class='id identifier rubyid_rv'>rv</span> <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>
758
+ <span class='id identifier rubyid_rv'>rv</span> <span class='op'>+=</span> <span class='float'>1E6</span> <span class='kw'>if</span> <span class='id identifier rubyid_rv'>rv</span> <span class='op'>==</span> <span class='id identifier rubyid_initial'>initial</span>
759
+ <span class='id identifier rubyid_rv'>rv</span>
760
+ <span class='kw'>end</span>
739
761
  <span class='kw'>end</span></pre>
740
762
  </td>
741
763
  </tr>
@@ -862,7 +884,18 @@
862
884
  93
863
885
  94
864
886
  95
865
- 96</pre>
887
+ 96
888
+ 97
889
+ 98
890
+ 99
891
+ 100
892
+ 101
893
+ 102
894
+ 103
895
+ 104
896
+ 105
897
+ 106
898
+ 107</pre>
866
899
  </td>
867
900
  <td>
868
901
  <pre class="code"><span class="info file"># File 'lib/elephas/entry.rb', line 20</span>
@@ -893,7 +926,7 @@
893
926
  </span> <span class='comment'># @param save [Boolean] If to save the refresh value in the cache.
894
927
  </span> <span class='comment'># @return [Float] The new updated_at value.
895
928
  </span> <span class='kw'>def</span> <span class='id identifier rubyid_refresh'>refresh</span><span class='lparen'>(</span><span class='id identifier rubyid_save'>save</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
896
- <span class='ivar'>@updated_at</span> <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>
929
+ <span class='ivar'>@updated_at</span> <span class='op'>=</span> <span class='id identifier rubyid_get_new_updated_at'>get_new_updated_at</span><span class='lparen'>(</span><span class='ivar'>@updated_at</span><span class='rparen'>)</span>
897
930
  <span class='const'>Elephas</span><span class='op'>::</span><span class='const'>Cache</span><span class='period'>.</span><span class='id identifier rubyid_provider'>provider</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='ivar'>@hash</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_save'>save</span>
898
931
  <span class='ivar'>@updated_at</span>
899
932
  <span class='kw'>end</span>
@@ -943,6 +976,17 @@
943
976
 
944
977
  <span class='id identifier rubyid_rv'>rv</span>
945
978
  <span class='kw'>end</span>
979
+
980
+ <span class='id identifier rubyid_private'>private</span>
981
+ <span class='comment'># Makes sure a new updated at is generated.
982
+ </span> <span class='comment'>#
983
+ </span> <span class='comment'># @param initial [Float] Old value.
984
+ </span> <span class='comment'># @return [Float] New value.
985
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_get_new_updated_at'>get_new_updated_at</span><span class='lparen'>(</span><span class='id identifier rubyid_initial'>initial</span><span class='rparen'>)</span>
986
+ <span class='id identifier rubyid_rv'>rv</span> <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>
987
+ <span class='id identifier rubyid_rv'>rv</span> <span class='op'>+=</span> <span class='float'>1E6</span> <span class='kw'>if</span> <span class='id identifier rubyid_rv'>rv</span> <span class='op'>==</span> <span class='id identifier rubyid_initial'>initial</span>
988
+ <span class='id identifier rubyid_rv'>rv</span>
989
+ <span class='kw'>end</span>
946
990
  <span class='kw'>end</span></pre>
947
991
  </td>
948
992
  </tr>
@@ -1069,7 +1113,18 @@
1069
1113
  93
1070
1114
  94
1071
1115
  95
1072
- 96</pre>
1116
+ 96
1117
+ 97
1118
+ 98
1119
+ 99
1120
+ 100
1121
+ 101
1122
+ 102
1123
+ 103
1124
+ 104
1125
+ 105
1126
+ 106
1127
+ 107</pre>
1073
1128
  </td>
1074
1129
  <td>
1075
1130
  <pre class="code"><span class="info file"># File 'lib/elephas/entry.rb', line 20</span>
@@ -1100,7 +1155,7 @@
1100
1155
  </span> <span class='comment'># @param save [Boolean] If to save the refresh value in the cache.
1101
1156
  </span> <span class='comment'># @return [Float] The new updated_at value.
1102
1157
  </span> <span class='kw'>def</span> <span class='id identifier rubyid_refresh'>refresh</span><span class='lparen'>(</span><span class='id identifier rubyid_save'>save</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
1103
- <span class='ivar'>@updated_at</span> <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>
1158
+ <span class='ivar'>@updated_at</span> <span class='op'>=</span> <span class='id identifier rubyid_get_new_updated_at'>get_new_updated_at</span><span class='lparen'>(</span><span class='ivar'>@updated_at</span><span class='rparen'>)</span>
1104
1159
  <span class='const'>Elephas</span><span class='op'>::</span><span class='const'>Cache</span><span class='period'>.</span><span class='id identifier rubyid_provider'>provider</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='ivar'>@hash</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_save'>save</span>
1105
1160
  <span class='ivar'>@updated_at</span>
1106
1161
  <span class='kw'>end</span>
@@ -1150,6 +1205,17 @@
1150
1205
 
1151
1206
  <span class='id identifier rubyid_rv'>rv</span>
1152
1207
  <span class='kw'>end</span>
1208
+
1209
+ <span class='id identifier rubyid_private'>private</span>
1210
+ <span class='comment'># Makes sure a new updated at is generated.
1211
+ </span> <span class='comment'>#
1212
+ </span> <span class='comment'># @param initial [Float] Old value.
1213
+ </span> <span class='comment'># @return [Float] New value.
1214
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_get_new_updated_at'>get_new_updated_at</span><span class='lparen'>(</span><span class='id identifier rubyid_initial'>initial</span><span class='rparen'>)</span>
1215
+ <span class='id identifier rubyid_rv'>rv</span> <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>
1216
+ <span class='id identifier rubyid_rv'>rv</span> <span class='op'>+=</span> <span class='float'>1E6</span> <span class='kw'>if</span> <span class='id identifier rubyid_rv'>rv</span> <span class='op'>==</span> <span class='id identifier rubyid_initial'>initial</span>
1217
+ <span class='id identifier rubyid_rv'>rv</span>
1218
+ <span class='kw'>end</span>
1153
1219
  <span class='kw'>end</span></pre>
1154
1220
  </td>
1155
1221
  </tr>
@@ -1276,7 +1342,18 @@
1276
1342
  93
1277
1343
  94
1278
1344
  95
1279
- 96</pre>
1345
+ 96
1346
+ 97
1347
+ 98
1348
+ 99
1349
+ 100
1350
+ 101
1351
+ 102
1352
+ 103
1353
+ 104
1354
+ 105
1355
+ 106
1356
+ 107</pre>
1280
1357
  </td>
1281
1358
  <td>
1282
1359
  <pre class="code"><span class="info file"># File 'lib/elephas/entry.rb', line 20</span>
@@ -1307,7 +1384,7 @@
1307
1384
  </span> <span class='comment'># @param save [Boolean] If to save the refresh value in the cache.
1308
1385
  </span> <span class='comment'># @return [Float] The new updated_at value.
1309
1386
  </span> <span class='kw'>def</span> <span class='id identifier rubyid_refresh'>refresh</span><span class='lparen'>(</span><span class='id identifier rubyid_save'>save</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
1310
- <span class='ivar'>@updated_at</span> <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>
1387
+ <span class='ivar'>@updated_at</span> <span class='op'>=</span> <span class='id identifier rubyid_get_new_updated_at'>get_new_updated_at</span><span class='lparen'>(</span><span class='ivar'>@updated_at</span><span class='rparen'>)</span>
1311
1388
  <span class='const'>Elephas</span><span class='op'>::</span><span class='const'>Cache</span><span class='period'>.</span><span class='id identifier rubyid_provider'>provider</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='ivar'>@hash</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_save'>save</span>
1312
1389
  <span class='ivar'>@updated_at</span>
1313
1390
  <span class='kw'>end</span>
@@ -1357,6 +1434,17 @@
1357
1434
 
1358
1435
  <span class='id identifier rubyid_rv'>rv</span>
1359
1436
  <span class='kw'>end</span>
1437
+
1438
+ <span class='id identifier rubyid_private'>private</span>
1439
+ <span class='comment'># Makes sure a new updated at is generated.
1440
+ </span> <span class='comment'>#
1441
+ </span> <span class='comment'># @param initial [Float] Old value.
1442
+ </span> <span class='comment'># @return [Float] New value.
1443
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_get_new_updated_at'>get_new_updated_at</span><span class='lparen'>(</span><span class='id identifier rubyid_initial'>initial</span><span class='rparen'>)</span>
1444
+ <span class='id identifier rubyid_rv'>rv</span> <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>
1445
+ <span class='id identifier rubyid_rv'>rv</span> <span class='op'>+=</span> <span class='float'>1E6</span> <span class='kw'>if</span> <span class='id identifier rubyid_rv'>rv</span> <span class='op'>==</span> <span class='id identifier rubyid_initial'>initial</span>
1446
+ <span class='id identifier rubyid_rv'>rv</span>
1447
+ <span class='kw'>end</span>
1360
1448
  <span class='kw'>end</span></pre>
1361
1449
  </td>
1362
1450
  </tr>
@@ -1483,7 +1571,18 @@
1483
1571
  93
1484
1572
  94
1485
1573
  95
1486
- 96</pre>
1574
+ 96
1575
+ 97
1576
+ 98
1577
+ 99
1578
+ 100
1579
+ 101
1580
+ 102
1581
+ 103
1582
+ 104
1583
+ 105
1584
+ 106
1585
+ 107</pre>
1487
1586
  </td>
1488
1587
  <td>
1489
1588
  <pre class="code"><span class="info file"># File 'lib/elephas/entry.rb', line 20</span>
@@ -1514,7 +1613,7 @@
1514
1613
  </span> <span class='comment'># @param save [Boolean] If to save the refresh value in the cache.
1515
1614
  </span> <span class='comment'># @return [Float] The new updated_at value.
1516
1615
  </span> <span class='kw'>def</span> <span class='id identifier rubyid_refresh'>refresh</span><span class='lparen'>(</span><span class='id identifier rubyid_save'>save</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
1517
- <span class='ivar'>@updated_at</span> <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>
1616
+ <span class='ivar'>@updated_at</span> <span class='op'>=</span> <span class='id identifier rubyid_get_new_updated_at'>get_new_updated_at</span><span class='lparen'>(</span><span class='ivar'>@updated_at</span><span class='rparen'>)</span>
1518
1617
  <span class='const'>Elephas</span><span class='op'>::</span><span class='const'>Cache</span><span class='period'>.</span><span class='id identifier rubyid_provider'>provider</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='ivar'>@hash</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_save'>save</span>
1519
1618
  <span class='ivar'>@updated_at</span>
1520
1619
  <span class='kw'>end</span>
@@ -1564,6 +1663,17 @@
1564
1663
 
1565
1664
  <span class='id identifier rubyid_rv'>rv</span>
1566
1665
  <span class='kw'>end</span>
1666
+
1667
+ <span class='id identifier rubyid_private'>private</span>
1668
+ <span class='comment'># Makes sure a new updated at is generated.
1669
+ </span> <span class='comment'>#
1670
+ </span> <span class='comment'># @param initial [Float] Old value.
1671
+ </span> <span class='comment'># @return [Float] New value.
1672
+ </span> <span class='kw'>def</span> <span class='id identifier rubyid_get_new_updated_at'>get_new_updated_at</span><span class='lparen'>(</span><span class='id identifier rubyid_initial'>initial</span><span class='rparen'>)</span>
1673
+ <span class='id identifier rubyid_rv'>rv</span> <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>
1674
+ <span class='id identifier rubyid_rv'>rv</span> <span class='op'>+=</span> <span class='float'>1E6</span> <span class='kw'>if</span> <span class='id identifier rubyid_rv'>rv</span> <span class='op'>==</span> <span class='id identifier rubyid_initial'>initial</span>
1675
+ <span class='id identifier rubyid_rv'>rv</span>
1676
+ <span class='kw'>end</span>
1567
1677
  <span class='kw'>end</span></pre>
1568
1678
  </td>
1569
1679
  </tr>
@@ -1938,7 +2048,7 @@
1938
2048
  <pre class="code"><span class="info file"># File 'lib/elephas/entry.rb', line 45</span>
1939
2049
 
1940
2050
  <span class='kw'>def</span> <span class='id identifier rubyid_refresh'>refresh</span><span class='lparen'>(</span><span class='id identifier rubyid_save'>save</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
1941
- <span class='ivar'>@updated_at</span> <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>
2051
+ <span class='ivar'>@updated_at</span> <span class='op'>=</span> <span class='id identifier rubyid_get_new_updated_at'>get_new_updated_at</span><span class='lparen'>(</span><span class='ivar'>@updated_at</span><span class='rparen'>)</span>
1942
2052
  <span class='const'>Elephas</span><span class='op'>::</span><span class='const'>Cache</span><span class='period'>.</span><span class='id identifier rubyid_provider'>provider</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='ivar'>@hash</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_save'>save</span>
1943
2053
  <span class='ivar'>@updated_at</span>
1944
2054
  <span class='kw'>end</span></pre>
@@ -2032,7 +2142,7 @@
2032
2142
  </div>
2033
2143
 
2034
2144
  <div id="footer">
2035
- Generated on Thu Feb 7 08:33:46 2013 by
2145
+ Generated on Thu Feb 7 21:28:08 2013 by
2036
2146
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
2037
2147
  0.8.4.1 (ruby-1.9.3).
2038
2148
  </div>
@@ -577,7 +577,7 @@
577
577
 
578
578
 
579
579
  &mdash;
580
- <div class='inline'><p>The value to write. Setting a value to <code>nil</code> <strong>doesn&#39;t</strong> mean <em>deleting</em> the value.</p>
580
+ <div class='inline'><p>The value to write. Setting a value to <code>nil</code> <strong>doesnt</strong> mean <em>deleting</em> the value.</p>
581
581
  </div>
582
582
 
583
583
  </li>
@@ -652,7 +652,7 @@
652
652
  </div>
653
653
 
654
654
  <div id="footer">
655
- Generated on Thu Feb 7 08:33:46 2013 by
655
+ Generated on Thu Feb 7 21:28:08 2013 by
656
656
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
657
657
  0.8.4.1 (ruby-1.9.3).
658
658
  </div>
@@ -806,7 +806,7 @@
806
806
 
807
807
 
808
808
  &mdash;
809
- <div class='inline'><p>The value to write. Setting a value to <code>nil</code> <strong>doesn&#39;t</strong> mean <em>deleting</em> the value.</p>
809
+ <div class='inline'><p>The value to write. Setting a value to <code>nil</code> <strong>doesnt</strong> mean <em>deleting</em> the value.</p>
810
810
  </div>
811
811
 
812
812
  </li>
@@ -887,7 +887,7 @@
887
887
  </div>
888
888
 
889
889
  <div id="footer">
890
- Generated on Thu Feb 7 08:33:46 2013 by
890
+ Generated on Thu Feb 7 21:28:09 2013 by
891
891
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
892
892
  0.8.4.1 (ruby-1.9.3).
893
893
  </div>
@@ -523,7 +523,7 @@
523
523
 
524
524
 
525
525
  &mdash;
526
- <div class='inline'><p>The value to write. <strong>Setting a value to <code>nil</code> **doesn&#39;t</strong> mean <em>deleting</em> the value.</p>
526
+ <div class='inline'><p>The value to write. <strong>Setting a value to <code>nil</code> **doesnt</strong> mean <em>deleting</em> the value.</p>
527
527
  </div>
528
528
 
529
529
  </li>
@@ -604,7 +604,7 @@
604
604
  </div>
605
605
 
606
606
  <div id="footer">
607
- Generated on Thu Feb 7 08:33:46 2013 by
607
+ Generated on Thu Feb 7 21:28:09 2013 by
608
608
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
609
609
  0.8.4.1 (ruby-1.9.3).
610
610
  </div>
@@ -120,7 +120,7 @@
120
120
  </div>
121
121
 
122
122
  <div id="footer">
123
- Generated on Thu Feb 7 08:33:46 2013 by
123
+ Generated on Thu Feb 7 21:28:08 2013 by
124
124
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
125
125
  0.8.4.1 (ruby-1.9.3).
126
126
  </div>
@@ -149,7 +149,7 @@
149
149
 
150
150
  </div>
151
151
  </dt>
152
- <dd><pre class="code"><span class='int'>0</span></pre></dd>
152
+ <dd><pre class="code"><span class='int'>1</span></pre></dd>
153
153
 
154
154
  <dt id="STRING-constant" class="">STRING =
155
155
  <div class="docstring">
@@ -180,7 +180,7 @@
180
180
  </div>
181
181
 
182
182
  <div id="footer">
183
- Generated on Thu Feb 7 08:33:46 2013 by
183
+ Generated on Thu Feb 7 21:28:08 2013 by
184
184
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
185
185
  0.8.4.1 (ruby-1.9.3).
186
186
  </div>
data/doc/Elephas.html CHANGED
@@ -88,8 +88,8 @@
88
88
 
89
89
  <h2>Overview</h2><div class="docstring">
90
90
  <div class="discussion">
91
- <p>This file is part of the elephas gem. Copyright (C) 2013 and above Shogun <shogun_panda@me.com>.
92
- Licensed under the MIT license, which can be found at <a href="http://www.opensource.org/licenses/mit-license.php">http://www.opensource.org/licenses/mit-license.php</a>.</p>
91
+ <p>This file is part of the elephas gem. Copyright (C) 2013 and above Shogun &lt;shogun_panda@me.com&gt;.
92
+ Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.</p>
93
93
 
94
94
 
95
95
  </div>
@@ -121,7 +121,7 @@ Licensed under the MIT license, which can be found at <a href="http://www.openso
121
121
  </div>
122
122
 
123
123
  <div id="footer">
124
- Generated on Thu Feb 7 08:33:46 2013 by
124
+ Generated on Thu Feb 7 21:28:08 2013 by
125
125
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
126
126
  0.8.4.1 (ruby-1.9.3).
127
127
  </div>
data/doc/_index.html CHANGED
@@ -198,7 +198,7 @@
198
198
  </div>
199
199
 
200
200
  <div id="footer">
201
- Generated on Thu Feb 7 08:33:46 2013 by
201
+ Generated on Thu Feb 7 21:28:08 2013 by
202
202
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
203
203
  0.8.4.1 (ruby-1.9.3).
204
204
  </div>
data/doc/file.README.html CHANGED
@@ -61,38 +61,40 @@
61
61
 
62
62
  <iframe id="search_frame"></iframe>
63
63
 
64
- <div id="content"><div id='filecontents'><h1>elephas</h1>
64
+ <div id="content"><div id='filecontents'><h1 id="elephas">elephas</h1>
65
65
 
66
- <p><a href="http://travis-ci.org/ShogunPanda/elephas"><img src="https://secure.travis-ci.org/ShogunPanda/elephas.png?branch=master" alt="Build Status"></a>
67
- <a href="https://gemnasium.com/ShogunPanda/elephas"><img src="https://gemnasium.com/ShogunPanda/elephas.png?travis" alt="Dependency Status"></a>
68
- <a href="https://codeclimate.com/github/ShogunPanda/elephas"><img src="https://codeclimate.com/github/ShogunPanda/elephas.png" alt="Code Climate"></a></p>
66
+ <p><a href="http://travis-ci.org/ShogunPanda/elephas"><img src="https://secure.travis-ci.org/ShogunPanda/elephas.png?branch=master" alt="Build Status" /></a>
67
+ <a href="https://gemnasium.com/ShogunPanda/elephas"><img src="https://gemnasium.com/ShogunPanda/elephas.png?travis" alt="Dependency Status" /></a>
68
+ <a href="https://codeclimate.com/github/ShogunPanda/elephas"><img src="https://codeclimate.com/github/ShogunPanda/elephas.png" alt="Code Climate" /></a></p>
69
69
 
70
70
  <p>A storage agnostic caching framework.</p>
71
71
 
72
- <p><a href="http://sw.cow.tc/elephas">http://sw.cow.tc/elephas</a></p>
72
+ <p>http://sw.cow.tc/elephas</p>
73
73
 
74
- <p><a href="http://rdoc.info/gems/elephas">http://rdoc.info/gems/elephas</a></p>
74
+ <p>http://rdoc.info/gems/elephas</p>
75
75
 
76
- <h2>Usage</h2>
76
+ <h2 id="usage">Usage</h2>
77
77
 
78
78
  <p>The usage of the framework is really simple.</p>
79
79
 
80
80
  <p>At first you have to setup a provider (that is, a storage) for the Elephas. By default it uses an internal hash, and also Rails is supported.</p>
81
81
 
82
- <pre class="code ruby"><code class="ruby"><span class='const'>Elephas</span><span class='op'>::</span><span class='const'>Cache</span><span class='period'>.</span><span class='id identifier rubyid_provider'>provider</span> <span class='op'>=</span> <span class='const'>Elephas</span><span class='op'>::</span><span class='const'>Providers</span><span class='op'>::</span><span class='const'>RubyOnRails</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
83
- </code></pre>
82
+ <p><code>ruby
83
+ Elephas::Cache.provider = Elephas::Providers::RubyOnRails.new
84
+ </code></p>
84
85
 
85
86
  <p>After that, you can query the framework for a value use the <code>use</code> method.</p>
86
87
 
87
88
  <p>You should also pass a block to the method, so that the framework use that for computing the value of the cache entry.</p>
88
89
 
89
- <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='const'>Elephas</span><span class='op'>::</span><span class='const'>Cache</span><span class='period'>.</span><span class='id identifier rubyid_use'>use</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>KEY</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_options'>options</span><span class='op'>|</span>
90
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>VALUE</span><span class='tstring_end'>&quot;</span></span>
91
- <span class='kw'>end</span>
92
- <span class='comment'># =&gt; &quot;VALUE&quot;
93
- </span></code></pre>
90
+ <p><code>ruby
91
+ value = Elephas::Cache.use("KEY") do |options|
92
+ "VALUE"
93
+ end
94
+ # =&gt; "VALUE"
95
+ </code></p>
94
96
 
95
- <p>The next time you issue this call, the block won&#39;t be called.</p>
97
+ <p>The next time you issue this call, the block won&#8217;t be called.</p>
96
98
 
97
99
  <p>The block takes an argument, which contains all the options for the entry.</p>
98
100
 
@@ -102,29 +104,29 @@
102
104
 
103
105
  <p>See documentation for more informations.</p>
104
106
 
105
- <p><strong>You&#39;re done!</strong></p>
107
+ <p><strong>You&#8217;re done!</strong></p>
106
108
 
107
- <h2>Contributing to elephas</h2>
109
+ <h2 id="contributing-to-elephas">Contributing to elephas</h2>
108
110
 
109
111
  <ul>
110
- <li>Check out the latest master to make sure the feature hasn&#39;t been implemented or the bug hasn&#39;t been fixed yet.</li>
111
- <li>Check out the issue tracker to make sure someone already hasn&#39;t requested it and/or contributed it.</li>
112
- <li>Fork the project.</li>
113
- <li>Start a feature/bugfix branch.</li>
114
- <li>Commit and push until you are happy with your contribution.</li>
115
- <li>Make sure to add tests for it. This is important so I don&#39;t break it in a future version unintentionally.</li>
116
- <li>Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.</li>
112
+ <li>Check out the latest master to make sure the feature hasn&#8217;t been implemented or the bug hasn&#8217;t been fixed yet.</li>
113
+ <li>Check out the issue tracker to make sure someone already hasn&#8217;t requested it and/or contributed it.</li>
114
+ <li>Fork the project.</li>
115
+ <li>Start a feature/bugfix branch.</li>
116
+ <li>Commit and push until you are happy with your contribution.</li>
117
+ <li>Make sure to add tests for it. This is important so I don&#8217;t break it in a future version unintentionally.</li>
118
+ <li>Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.</li>
117
119
  </ul>
118
120
 
119
- <h2>Copyright</h2>
121
+ <h2 id="copyright">Copyright</h2>
120
122
 
121
- <p>Copyright (C) 2013 and above Shogun (<a href="mailto:shogun_panda@me.com">shogun_panda@me.com</a>).</p>
123
+ <p>Copyright (C) 2013 and above Shogun (shogun_panda@me.com).</p>
122
124
 
123
- <p>Licensed under the MIT license, which can be found at <a href="http://www.opensource.org/licenses/mit-license.php">http://www.opensource.org/licenses/mit-license.php</a>.</p>
125
+ <p>Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.</p>
124
126
  </div></div>
125
127
 
126
128
  <div id="footer">
127
- Generated on Thu Feb 7 08:33:46 2013 by
129
+ Generated on Thu Feb 7 21:28:08 2013 by
128
130
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
129
131
  0.8.4.1 (ruby-1.9.3).
130
132
  </div>
data/doc/index.html CHANGED
@@ -61,38 +61,40 @@
61
61
 
62
62
  <iframe id="search_frame"></iframe>
63
63
 
64
- <div id="content"><div id='filecontents'><h1>elephas</h1>
64
+ <div id="content"><div id='filecontents'><h1 id="elephas">elephas</h1>
65
65
 
66
- <p><a href="http://travis-ci.org/ShogunPanda/elephas"><img src="https://secure.travis-ci.org/ShogunPanda/elephas.png?branch=master" alt="Build Status"></a>
67
- <a href="https://gemnasium.com/ShogunPanda/elephas"><img src="https://gemnasium.com/ShogunPanda/elephas.png?travis" alt="Dependency Status"></a>
68
- <a href="https://codeclimate.com/github/ShogunPanda/elephas"><img src="https://codeclimate.com/github/ShogunPanda/elephas.png" alt="Code Climate"></a></p>
66
+ <p><a href="http://travis-ci.org/ShogunPanda/elephas"><img src="https://secure.travis-ci.org/ShogunPanda/elephas.png?branch=master" alt="Build Status" /></a>
67
+ <a href="https://gemnasium.com/ShogunPanda/elephas"><img src="https://gemnasium.com/ShogunPanda/elephas.png?travis" alt="Dependency Status" /></a>
68
+ <a href="https://codeclimate.com/github/ShogunPanda/elephas"><img src="https://codeclimate.com/github/ShogunPanda/elephas.png" alt="Code Climate" /></a></p>
69
69
 
70
70
  <p>A storage agnostic caching framework.</p>
71
71
 
72
- <p><a href="http://sw.cow.tc/elephas">http://sw.cow.tc/elephas</a></p>
72
+ <p>http://sw.cow.tc/elephas</p>
73
73
 
74
- <p><a href="http://rdoc.info/gems/elephas">http://rdoc.info/gems/elephas</a></p>
74
+ <p>http://rdoc.info/gems/elephas</p>
75
75
 
76
- <h2>Usage</h2>
76
+ <h2 id="usage">Usage</h2>
77
77
 
78
78
  <p>The usage of the framework is really simple.</p>
79
79
 
80
80
  <p>At first you have to setup a provider (that is, a storage) for the Elephas. By default it uses an internal hash, and also Rails is supported.</p>
81
81
 
82
- <pre class="code ruby"><code class="ruby"><span class='const'>Elephas</span><span class='op'>::</span><span class='const'>Cache</span><span class='period'>.</span><span class='id identifier rubyid_provider'>provider</span> <span class='op'>=</span> <span class='const'>Elephas</span><span class='op'>::</span><span class='const'>Providers</span><span class='op'>::</span><span class='const'>RubyOnRails</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
83
- </code></pre>
82
+ <p><code>ruby
83
+ Elephas::Cache.provider = Elephas::Providers::RubyOnRails.new
84
+ </code></p>
84
85
 
85
86
  <p>After that, you can query the framework for a value use the <code>use</code> method.</p>
86
87
 
87
88
  <p>You should also pass a block to the method, so that the framework use that for computing the value of the cache entry.</p>
88
89
 
89
- <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='const'>Elephas</span><span class='op'>::</span><span class='const'>Cache</span><span class='period'>.</span><span class='id identifier rubyid_use'>use</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>KEY</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_options'>options</span><span class='op'>|</span>
90
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>VALUE</span><span class='tstring_end'>&quot;</span></span>
91
- <span class='kw'>end</span>
92
- <span class='comment'># =&gt; &quot;VALUE&quot;
93
- </span></code></pre>
90
+ <p><code>ruby
91
+ value = Elephas::Cache.use("KEY") do |options|
92
+ "VALUE"
93
+ end
94
+ # =&gt; "VALUE"
95
+ </code></p>
94
96
 
95
- <p>The next time you issue this call, the block won&#39;t be called.</p>
97
+ <p>The next time you issue this call, the block won&#8217;t be called.</p>
96
98
 
97
99
  <p>The block takes an argument, which contains all the options for the entry.</p>
98
100
 
@@ -102,29 +104,29 @@
102
104
 
103
105
  <p>See documentation for more informations.</p>
104
106
 
105
- <p><strong>You&#39;re done!</strong></p>
107
+ <p><strong>You&#8217;re done!</strong></p>
106
108
 
107
- <h2>Contributing to elephas</h2>
109
+ <h2 id="contributing-to-elephas">Contributing to elephas</h2>
108
110
 
109
111
  <ul>
110
- <li>Check out the latest master to make sure the feature hasn&#39;t been implemented or the bug hasn&#39;t been fixed yet.</li>
111
- <li>Check out the issue tracker to make sure someone already hasn&#39;t requested it and/or contributed it.</li>
112
- <li>Fork the project.</li>
113
- <li>Start a feature/bugfix branch.</li>
114
- <li>Commit and push until you are happy with your contribution.</li>
115
- <li>Make sure to add tests for it. This is important so I don&#39;t break it in a future version unintentionally.</li>
116
- <li>Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.</li>
112
+ <li>Check out the latest master to make sure the feature hasn&#8217;t been implemented or the bug hasn&#8217;t been fixed yet.</li>
113
+ <li>Check out the issue tracker to make sure someone already hasn&#8217;t requested it and/or contributed it.</li>
114
+ <li>Fork the project.</li>
115
+ <li>Start a feature/bugfix branch.</li>
116
+ <li>Commit and push until you are happy with your contribution.</li>
117
+ <li>Make sure to add tests for it. This is important so I don&#8217;t break it in a future version unintentionally.</li>
118
+ <li>Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.</li>
117
119
  </ul>
118
120
 
119
- <h2>Copyright</h2>
121
+ <h2 id="copyright">Copyright</h2>
120
122
 
121
- <p>Copyright (C) 2013 and above Shogun (<a href="mailto:shogun_panda@me.com">shogun_panda@me.com</a>).</p>
123
+ <p>Copyright (C) 2013 and above Shogun (shogun_panda@me.com).</p>
122
124
 
123
- <p>Licensed under the MIT license, which can be found at <a href="http://www.opensource.org/licenses/mit-license.php">http://www.opensource.org/licenses/mit-license.php</a>.</p>
125
+ <p>Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.</p>
124
126
  </div></div>
125
127
 
126
128
  <div id="footer">
127
- Generated on Thu Feb 7 08:33:46 2013 by
129
+ Generated on Thu Feb 7 21:28:08 2013 by
128
130
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
129
131
  0.8.4.1 (ruby-1.9.3).
130
132
  </div>
@@ -103,7 +103,7 @@
103
103
  </div>
104
104
 
105
105
  <div id="footer">
106
- Generated on Thu Feb 7 08:33:46 2013 by
106
+ Generated on Thu Feb 7 21:28:08 2013 by
107
107
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
108
108
  0.8.4.1 (ruby-1.9.3).
109
109
  </div>
data/lib/elephas/entry.rb CHANGED
@@ -43,7 +43,7 @@ module Elephas
43
43
  # @param save [Boolean] If to save the refresh value in the cache.
44
44
  # @return [Float] The new updated_at value.
45
45
  def refresh(save = false)
46
- @updated_at = Time.now.to_f
46
+ @updated_at = get_new_updated_at(@updated_at)
47
47
  Elephas::Cache.provider.write(@hash, self) if save
48
48
  @updated_at
49
49
  end
@@ -93,5 +93,16 @@ module Elephas
93
93
 
94
94
  rv
95
95
  end
96
+
97
+ private
98
+ # Makes sure a new updated at is generated.
99
+ #
100
+ # @param initial [Float] Old value.
101
+ # @return [Float] New value.
102
+ def get_new_updated_at(initial)
103
+ rv = Time.now.to_f
104
+ rv += 1E6 if rv == initial
105
+ rv
106
+ end
96
107
  end
97
108
  end
@@ -17,7 +17,7 @@ module Elephas
17
17
  MINOR = 1
18
18
 
19
19
  # The patch version.
20
- PATCH = 0
20
+ PATCH = 1
21
21
 
22
22
  # The current version of elephas.
23
23
  STRING = [MAJOR, MINOR, PATCH].compact.join(".")
@@ -5,16 +5,13 @@
5
5
  #
6
6
 
7
7
  require "pathname"
8
+ require "simplecov"
8
9
 
9
- if ENV["ELEPHAS_COVERAGE"] == "TRUE" && RUBY_VERSION >= "1.9" then
10
- require "simplecov"
11
-
10
+ SimpleCov.start do
12
11
  root = Pathname.new(File.dirname(__FILE__)) + ".."
13
12
 
14
- SimpleCov.start do
15
- add_filter do |src_file|
16
- path = Pathname.new(src_file.filename).relative_path_from(root).to_s
17
- path !~ /^lib/
18
- end
13
+ add_filter do |src_file|
14
+ path = Pathname.new(src_file.filename).relative_path_from(root).to_s
15
+ path !~ /^lib/
19
16
  end
20
17
  end
@@ -13,6 +13,7 @@ describe Elephas::Providers::RubyOnRails do
13
13
  end
14
14
 
15
15
  def write(key, value, options = {})
16
+ self.delete(key)
16
17
  self[key] = value
17
18
  end
18
19
 
data/spec/spec_helper.rb CHANGED
@@ -5,7 +5,6 @@
5
5
  #
6
6
 
7
7
  require "rubygems"
8
- require "coverage_helper"
9
8
  require "bundler/setup"
10
9
  require "elephas"
11
10
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elephas
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-07 00:00:00.000000000 Z
12
+ date: 2013-02-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: lazier
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  version: '0'
101
101
  segments:
102
102
  - 0
103
- hash: -2315547574760873877
103
+ hash: 1754632980539960747
104
104
  requirements: []
105
105
  rubyforge_project: elephas
106
106
  rubygems_version: 1.8.25