Class: God::Registry

Inherits:
Object
  • Object
show all
Defined in:
lib/god/registry.rb

Instance Method Summary collapse

Constructor Details

#initializeRegistry

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

#resetObject



28
29
30
# File 'lib/god/registry.rb', line 28

def reset
  @storage.clear
end

#sizeObject



20
21
22
# File 'lib/god/registry.rb', line 20

def size
  @storage.size
end