lru_redux 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b3f0297d9fe3517fc8618150089f1fd9c7be2e52
4
- data.tar.gz: fe4b97bb0935477011f09063e4e5372a3ff88f8a
3
+ metadata.gz: b501fa162a36c12d13ff683ccbaa0e85ddda003d
4
+ data.tar.gz: 2888a33f2c15f078bec636d3782b8de0cb61f519
5
5
  SHA512:
6
- metadata.gz: 955339b2b777e904ac433848202155590815863804f71e48ff78f1f8077c365bada7dcc4a4050301c482a1d21e96ec28165b2bb1b817966da4d539e281df65a7
7
- data.tar.gz: adde05c954aa10c9c708c64d06787aff921e883b92400e736a3027452cd327b6b47dea3da0c6af069567e10ffb7a7d5ca56bb125a720ecd22cbbc2dde4a59c03
6
+ metadata.gz: 5290cdf6e1b0a5014154891464790005625451db37c7959217da68b6f1f6a3ad41d46370bdcb734ed098cda4cb3945a12ea805284898c213c581a9f9b913d83c
7
+ data.tar.gz: 7b1cf05f55aa7f314ef9b4b346dca6d7ca20bf5458e893c4a32d4ae1fcb225a3bc6f2992cd1aee54e944f5e03e77cfeacecde69e46b711b272ebb1fe2648c0cd
data/README.md CHANGED
@@ -95,6 +95,10 @@ lru_redux thread safe 2.480000 0.000000 2.480000 ( 2.488169)
95
95
 
96
96
  ## Changlog
97
97
 
98
+ ###version 0.0.6 - 24-April-2013
99
+
100
+ - Fix bug in getset, overflow was not returning the yeilded val
101
+
98
102
  ###version 0.0.5 - 23-April-2013
99
103
 
100
104
  - Added getset and fetch
@@ -23,8 +23,10 @@ class LruRedux::Cache
23
23
  if found
24
24
  @data[key] = value
25
25
  else
26
- @data[key] = yield
26
+ result = @data[key] = yield
27
+ # this may seem odd see: http://bugs.ruby-lang.org/issues/8312
27
28
  @data.delete(@data.first[0]) if @data.length > @max_size
29
+ result
28
30
  end
29
31
  end
30
32
 
@@ -51,6 +53,7 @@ class LruRedux::Cache
51
53
  def []=(key,val)
52
54
  @data.delete(key)
53
55
  @data[key] = val
56
+ # this may seem odd see: http://bugs.ruby-lang.org/issues/8312
54
57
  @data.delete(@data.first[0]) if @data.length > @max_size
55
58
  val
56
59
  end
@@ -1,3 +1,3 @@
1
1
  module LruRedux
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
data/test/cache_test.rb CHANGED
@@ -31,11 +31,11 @@ class CacheTest < MiniTest::Unit::TestCase
31
31
  end
32
32
 
33
33
  def test_getset
34
- @c.getset(:a){1}
34
+ assert_equal @c.getset(:a){1}, 1
35
35
  @c.getset(:b){2}
36
36
  assert_equal @c.getset(:a){11}, 1
37
37
  @c.getset(:c){3}
38
- @c.getset(:d){4}
38
+ assert_equal @c.getset(:d){4}, 4
39
39
 
40
40
  assert_equal [[:d,4],[:c,3],[:a,1]], @c.to_a
41
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lru_redux
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Saffron