lib/nanoc/base/store.rb in nanoc-3.6.7 vs lib/nanoc/base/store.rb in nanoc-3.6.8
- old
+ new
@@ -42,20 +42,20 @@
# @return The data that should be written to the disk
#
# @abstract This method must be implemented by the subclass.
def data
- raise NotImplementedError.new("Nanoc::Store subclasses must implement #data and #data=")
+ raise NotImplementedError.new('Nanoc::Store subclasses must implement #data and #data=')
end
# @param new_data The data that has been loaded from the disk
#
# @abstract This method must be implemented by the subclass.
#
# @return [void]
def data=(new_data)
- raise NotImplementedError.new("Nanoc::Store subclasses must implement #data and #data=")
+ raise NotImplementedError.new('Nanoc::Store subclasses must implement #data and #data=')
end
# Loads the data from the filesystem into memory. This method will set the
# loaded data using the {#data=} method.
#
@@ -65,19 +65,19 @@
if @loaded
return
end
# Check file existance
- if !File.file?(self.filename)
+ if !File.file?(filename)
no_data_found
@loaded = true
return
end
pstore.transaction do
# Check version
- if pstore[:version] != self.version
+ if pstore[:version] != version
version_mismatch_detected
@loaded = true
return
end
@@ -96,15 +96,15 @@
# Stores the data contained in memory to the filesystem. This method will
# use the {#data} method to fetch the data that should be written.
#
# @return [void]
def store
- FileUtils.mkdir_p(File.dirname(self.filename))
+ FileUtils.mkdir_p(File.dirname(filename))
pstore.transaction do
- pstore[:data] = self.data
- pstore[:version] = self.version
+ pstore[:data] = data
+ pstore[:version] = version
end
end
# @group Callback methods
@@ -125,10 +125,10 @@
end
private
def pstore
- @pstore ||= PStore.new(self.filename)
+ @pstore ||= PStore.new(filename)
end
end
end