The serializer must have the 2 methods .load and .dump (Marshal and YAML have them) YAML is Human Readable, contrary to Marshal which store in a binary format Marshal does not need any “require”
# File lib/cache_file_store.rb, line 34 def initialize(storage_path, serializer = Marshal) @storage_path = File.expand_path(storage_path) @serializer = serializer # File.directory? for ruby <= 1.9 otherwise, it makes more sense to do Dir.exist? :/ if !File.directory?(@storage_path) Dir.mkdir(@storage_path) end end
# File lib/cache_file_store.rb, line 44 def clean Dir[File.join(@storage_path, '*')].each do |f| File.delete(f) end end
# File lib/cache_file_store.rb, line 66 def get_entry_file_path(key) @storage_path + '/' + key end
Generated with the Darkfish Rdoc Generator 2.