about summary refs log tree commit
path: root/lib/metropolis/hash.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-11-30 15:46:36 -0800
committerEric Wong <normalperson@yhbt.net>2010-11-30 15:46:36 -0800
commit03755186d6cb968d44d7eb04de3ed2d047180272 (patch)
tree3a72dcdb4f48cb9c17bda1bd91405cb3adb95e84 /lib/metropolis/hash.rb
parenta76f41647fb66ac39df43f31bbdff44b9e9a6b35 (diff)
downloadmetropolis-03755186d6cb968d44d7eb04de3ed2d047180272.tar.gz
hash: fix some settings for memory-only hash
These have no finalizers.
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