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
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/langrove/ext/module_loader.rb', line 5
def create(args={})
unless args[:config].has_key?(args[:key])
mandatory = args[:mandatory]
mandatory = true if mandatory.nil?
if mandatory
raise DaemonConfigException, "Cannot find key with '#{args[:key]}'"
else
return nil
end
end
params = {
:class => "Default",
:module => args[:key].to_s.camelize
}
begin
class_name = args[:config][args[:key]][:class]
rescue
end
params.merge!(:class => class_name) unless class_name.nil?
ClassLoader.create(params, args[:logger])
end
|