Class: Sappho::ModuleRegister
- Inherits:
-
Object
- Object
- Sappho::ModuleRegister
show all
- Defined in:
- lib/sappho-basics/module_register.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of ModuleRegister.
13
14
15
|
# File 'lib/sappho-basics/module_register.rb', line 13
def initialize modules = {}
@modules = modules
end
|
Instance Method Details
#each ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/sappho-basics/module_register.rb', line 33
def each
@modules.each do |name, mod|
if mod.instance_of? ModuleRegister
mod.each { |mod| yield mod }
else
begin
yield mod
rescue
end
end
end
end
|
#get(name) ⇒ Object
21
22
23
|
# File 'lib/sappho-basics/module_register.rb', line 21
def get name
@modules[name]
end
|
#set(name, mod) ⇒ Object
17
18
19
|
# File 'lib/sappho-basics/module_register.rb', line 17
def set name, mod
@modules[name] = mod
end
|
#set?(name) ⇒ Boolean
25
26
27
|
# File 'lib/sappho-basics/module_register.rb', line 25
def set? name
@modules.has_key? name
end
|
#shutdown ⇒ Object
29
30
31
|
# File 'lib/sappho-basics/module_register.rb', line 29
def shutdown
each { |mod| mod.shutdown }
end
|