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.
7 8 9 |
# File 'lib/god/registry.rb', line 7 def initialize @storage = {} end |
Instance Method Details
#[](name) ⇒ Object
24 25 26 |
# File 'lib/god/registry.rb', line 24 def [](name) @storage[name] end |
#add(item) ⇒ Object
11 12 13 14 |
# File 'lib/god/registry.rb', line 11 def add(item) # raise TypeError unless item.is_a? God::Process @storage[item.name] = item end |
#remove(item) ⇒ Object
16 17 18 |
# File 'lib/god/registry.rb', line 16 def remove(item) @storage.delete(item.name) end |
#reset ⇒ Object
28 29 30 |
# File 'lib/god/registry.rb', line 28 def reset @storage.clear end |
#size ⇒ Object
20 21 22 |
# File 'lib/god/registry.rb', line 20 def size @storage.size end |