hashcache 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/hashcache.rb +8 -3
  2. metadata +1 -1
data/lib/hashcache.rb CHANGED
@@ -13,11 +13,16 @@ class HashCache
13
13
 
14
14
  def read(item)
15
15
  if @h.include? item then
16
- val = @h[item]; @h.delete(item); @h[item] = val
16
+ val = @h[item]
17
+ @h.delete(item)
18
+ @h[item] = val
19
+ val
17
20
  else
18
- @h[item] = yield
21
+ val = yield
22
+ @h[item] = val
19
23
  @h.shift if @h.length > @size
20
- end
24
+ val
25
+ end
21
26
  end
22
27
 
23
28
  def reset
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hashcache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors: []
7
7