storage.rb
721 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
module DsAdmin::Storage
include Enumerable
DsAdmin::Storage.autoload(:Ldap, 'storage/ldap')
DsAdmin::Storage.autoload(:Mysql, 'storage/mysql')
DsAdmin::Storage.autoload(:Config, 'storage/config')
attr_accessor :config
def initialize(config)
@config = config
end
def each(&block)
read.each(&block)
end
##
# We don't need this....the 'id' is a storage id and as
# thus returned after successfully writing a new entry.
#
def create_id(model)
return "dummy id for #{model.inspect}"
end
def read
throw "#{self.class}: read not implemented"
end
def write(model)
throw "#{self.class}: write not implemented"
end
def to_sym
self.class.to_s.to_sym
end
end