summaryrefslogtreecommitdiff
path: root/lib/rbot
diff options
context:
space:
mode:
authorMatthias Hecker <mail@apoc.cc>2020-04-06 20:19:50 +0200
committerMatthias Hecker <mail@apoc.cc>2020-04-06 20:19:50 +0200
commit628bf10d8ad8536b98b85c529fe92e8ac56a9c4d (patch)
tree0d4d40aedd7930ab8a36b4265b620ccfab132fac /lib/rbot
parent263e939f1a8b8adf35afc33ab547dff8d4b97a4e (diff)
registry: add in-memory implementation for tests
Diffstat (limited to 'lib/rbot')
-rw-r--r--lib/rbot/registry.rb2
-rw-r--r--lib/rbot/registry/mem.rb30
2 files changed, 31 insertions, 1 deletions
diff --git a/lib/rbot/registry.rb b/lib/rbot/registry.rb
index 04892d73..61d4b33e 100644
--- a/lib/rbot/registry.rb
+++ b/lib/rbot/registry.rb
@@ -110,7 +110,7 @@ class Registry
attr_accessor :recovery
def initialize(filename)
- debug 'init registry accessor for: ' + filename
+ debug "init registry accessor of #{self.class} for: #{filename}"
@filename = filename
@name = File.basename filename
@registry = nil
diff --git a/lib/rbot/registry/mem.rb b/lib/rbot/registry/mem.rb
new file mode 100644
index 00000000..85d52b15
--- /dev/null
+++ b/lib/rbot/registry/mem.rb
@@ -0,0 +1,30 @@
+#-- vim:sw=2:et
+#++
+#
+# :title: Memory registry implementation
+#
+# This is using a in-memory hash, does not persist, used for
+# tests, etc.
+#
+
+module Irc
+class Bot
+class Registry
+
+ class MemAccessor < AbstractAccessor
+
+ def registry
+ super
+ @registry = {}
+ end
+
+ def dbexists?
+ true # the memory database always exists, this way it won't create any folders on the file system
+ end
+
+ end
+
+end # Registry
+end # Bot
+end # Irc
+