lib/picky/backends/memory/basic.rb in picky-4.27.1 vs lib/picky/backends/memory/basic.rb in picky-4.28.1
- old
+ new
@@ -13,31 +13,37 @@
#
class Basic
include Helpers::File
- # This file's location.
+ # This file's cache file without extensions.
#
- attr_reader :cache_path
+ attr_reader :cache_file_path
# What hash type to use. Default: ::Hash
#
attr_reader :hash_type
# An index cache takes a path, without file extension,
# which will be provided by the subclasses.
#
- def initialize cache_path, hash_type = Hash, options = {}
- @cache_path = "#{cache_path}.memory.#{extension}"
- @hash_type = hash_type
- @empty = options[:empty]
- @initial = options[:initial]
+ def initialize cache_file_path, hash_type = Hash, options = {}
+ @cache_file_path = cache_file_path
+ @hash_type = hash_type
+ @empty = options[:empty]
+ @initial = options[:initial]
end
# The default extension for index files is "index".
#
def extension
:index
+ end
+ def type
+ :memory
+ end
+ def cache_path
+ [cache_file_path, type, extension].join(?.)
end
# The empty index that is used for putting the index
# together before it is dumped into the files.
#
\ No newline at end of file