]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blob - lib/rbot/registry/dbm.rb
plugin(script): remove deprecated $SAFE
[user/henk/code/ruby/rbot.git] / lib / rbot / registry / dbm.rb
1 #-- vim:sw=2:et
2 #++
3 #
4 # :title: DBM registry implementation
5 #
6 # DBM is the ruby standard library wrapper module for Unix-style
7 # dbm libraries. The specific library used depends
8 # on how ruby was compiled. Its any of the following: ndbm, bdb,
9 # gdbm or qdbm.
10 # http://ruby-doc.org/stdlib-2.1.0/libdoc/dbm/rdoc/DBM.html
11 #
12
13 require 'dbm'
14
15 module Irc
16 class Bot
17 class Registry
18
19   class DBMAccessor < AbstractAccessor
20
21     def registry
22       super
23       @registry ||= DBM.open(@filename, 0666, DBM::WRCREAT)
24     end
25
26     def dbexists?
27       not Dir.glob(@filename + '.*').empty?
28     end
29
30   end
31
32 end # Registry
33 end # Bot
34 end # Irc
35