about summary refs log tree commit
path: root/lib/metropolis/tdb/single.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/metropolis/tdb/single.rb')
-rw-r--r--lib/metropolis/tdb/single.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/metropolis/tdb/single.rb b/lib/metropolis/tdb/single.rb
new file mode 100644
index 0000000..840b57a
--- /dev/null
+++ b/lib/metropolis/tdb/single.rb
@@ -0,0 +1,16 @@
+# -*- encoding: binary -*-
+module Metropolis::TDB::Single
+  def self.extended(obj)
+    obj.instance_eval do
+      @db = ::TDB.new(@uri.path, @tdb_opts)
+    end
+  end
+
+  def db(key, &block)
+    yield @db
+  end
+
+  def close!
+    @db.close
+  end
+end