Class: God::Registry
- Inherits:
-
Object
- Object
- God::Registry
- Defined in:
- lib/god/registry.rb
Instance Method Summary collapse
- #[](name) ⇒ Object
- #add(item) ⇒ Object
-
#initialize ⇒ Registry
constructor
A new instance of Registry.
- #remove(item) ⇒ Object
- #reset ⇒ Object
- #size ⇒ Object
Constructor Details
#initialize ⇒ Registry
Returns a new instance of Registry.
9 10 11 |
# File 'lib/god/registry.rb', line 9 def initialize @storage = {} end |
Instance Method Details
#[](name) ⇒ Object
26 27 28 |
# File 'lib/god/registry.rb', line 26 def [](name) @storage[name] end |
#add(item) ⇒ Object
13 14 15 16 |
# File 'lib/god/registry.rb', line 13 def add(item) # raise TypeError unless item.is_a? God::Process @storage[item.name] = item end |
#remove(item) ⇒ Object
18 19 20 |
# File 'lib/god/registry.rb', line 18 def remove(item) @storage.delete(item.name) end |
#reset ⇒ Object
30 31 32 |
# File 'lib/god/registry.rb', line 30 def reset @storage.clear end |
#size ⇒ Object
22 23 24 |
# File 'lib/god/registry.rb', line 22 def size @storage.size end |