lib/disk_cache.rb in disk_cache-0.0.4 vs lib/disk_cache.rb in disk_cache-0.0.5
- old
+ new
@@ -87,10 +87,14 @@
path_h(hsh) + filename_h(hsh)
end
# Public: this removes all contents of the cache.
def clear!
- FileUtils.rm_r cache_dir if File.exists? cache_dir
+ if File.exists? cache_dir
+ Dir.glob(cache_dir + '*').each do |f|
+ FileUtils.rm_r f
+ end
+ end
end
private
# Internal: Hashes a given piece of data with SHA1