Skip to content

Commit af36a40

Browse files
committed
Update for Ruby >= 3 compatibility
Proc.new without a block used to capture a block passed to a method. This was removed in Ruby 3. Previously it was a faster way to wrap a block and call it than the &block argument. `yield` is still the quickest way to invoke a passed block and `fetch` requires a block so we can safely call yield w/o checking
1 parent 339ed0d commit af36a40

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/cacheable/cache_adapters/memory_adapter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def exist?(key)
2020
def fetch(key, _options = {})
2121
return read(key) if exist?(key)
2222

23-
write(key, Proc.new.call)
23+
write(key, yield)
2424
end
2525

2626
def delete(key)

0 commit comments

Comments
 (0)