lib/nanoc/base/repos/store.rb in nanoc-4.4.5 vs lib/nanoc/base/repos/store.rb in nanoc-4.4.6
- old
+ new
@@ -64,25 +64,15 @@
# Loads the data from the filesystem into memory. This method will set the
# loaded data using the {#data=} method.
#
# @return [void]
def load
- # Check file existance
- unless File.file?(filename)
- no_data_found
- return
- end
+ return unless File.file?(filename)
begin
pstore.transaction do
- # Check version
- if pstore[:version] != version
- version_mismatch_detected
- return
- end
-
- # Load
+ return if pstore[:version] != version
self.data = pstore[:data]
end
rescue
FileUtils.rm_f(filename)
load
@@ -99,25 +89,9 @@
pstore.transaction do
pstore[:data] = data
pstore[:version] = version
end
end
-
- # @group Callback methods
-
- # Callback method that is called when no data file was found. By default,
- # this implementation does nothing, but it should probably be overridden
- # by the subclass.
- #
- # @return [void]
- def no_data_found; end
-
- # Callback method that is called when a version mismatch is detected. By
- # default, this implementation does nothing, but it should probably be
- # overridden by the subclass.
- #
- # @return [void]
- def version_mismatch_detected; end
private
def pstore
@pstore ||= PStore.new(filename)