lib/rbbt/persist.rb in rbbt-util-5.23.39 vs lib/rbbt/persist.rb in rbbt-util-5.24.0
- old
+ new
@@ -348,10 +348,13 @@
def self.persist(name, type = nil, persist_options = {}, &block)
type ||= :marshal
persist_options ||= {}
- if type ==:memory and persist_options[:file] and persist_options[:persist] and persist_options[:persist] != :update and not persist_options[:update]
+ if type == :memory and persist_options[:file] and persist_options[:persist]
+ if persist_options[:persist] == :update || persist_options[:update]
+ (persist_options[:repo] || Persist::MEMORY).delete persist_options[:file]
+ end
return (persist_options[:repo] || Persist::MEMORY)[persist_options[:file]] ||= yield
end
if FalseClass === persist_options[:persist]
yield