about summary refs log tree commit
path: root/lib/metropolis/hash.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/metropolis/hash.rb')
-rw-r--r--lib/metropolis/hash.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/metropolis/hash.rb b/lib/metropolis/hash.rb
index 61b7199..fb4d272 100644
--- a/lib/metropolis/hash.rb
+++ b/lib/metropolis/hash.rb
@@ -20,7 +20,7 @@ module Metropolis::Hash
     end
     if @readonly
       extend Metropolis::Common::RO
-    else
+    elsif @path
       args = [ @db, @path, !!opts[:fsync] ]
       @clean_proc = Metropolis::Hash.finalizer_callback(args)
       ObjectSpace.define_finalizer(self, @clean_proc)
@@ -28,7 +28,7 @@ module Metropolis::Hash
   end
 
   def close!
-    unless @readonly
+    if ! @readonly && ! @path.nil?
       @clean_proc.call
       ObjectSpace.undefine_finalizer(self)
     end