Class: Chassis::Registry

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

Instance Method Summary collapse

Constructor Details

#initializeRegistry



7
8
9
# File 'lib/chassis/registry.rb', line 7

def initialize
  @map = { }
end

Instance Method Details

#[]=(key, value) ⇒ Object



11
12
13
# File 'lib/chassis/registry.rb', line 11

def []=(key, value)
  map[key] = value
end

#clearObject



21
22
23
# File 'lib/chassis/registry.rb', line 21

def clear
  map.clear
end

#fetch(key) ⇒ Object



15
16
17
18
19
# File 'lib/chassis/registry.rb', line 15

def fetch(key)
  map.fetch key do
    fail UnregisteredError, key
  end
end