Browse files

No need for extra read in fetch.

  • Loading branch information...
1 parent 52af525 commit 587ea6ddedc0c4e352b7c86803933134628305f4 @jnunemaker committed Nov 8, 2012
Showing with 5 additions and 2 deletions.
  1. +5 −2 lib/adapter/defaults.rb
View
7 lib/adapter/defaults.rb
@@ -2,8 +2,11 @@ module Adapter
module Defaults
def fetch(key, value=nil)
read(key) || begin
- value = block_given? ? yield(key) : value
- read(key) || value
+ if block_given?
+ yield(key)
+ else
+ value
+ end
end
end

0 comments on commit 587ea6d

Please sign in to comment.