Class: Chassis::Registry
- Inherits:
-
Object
- Object
- Chassis::Registry
- Defined in:
- lib/chassis/registry.rb
Instance Method Summary collapse
- #[]=(key, value) ⇒ Object
- #clear ⇒ Object
- #fetch(key) ⇒ Object
-
#initialize ⇒ Registry
constructor
A new instance of Registry.
Constructor Details
#initialize ⇒ Registry
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 |
#clear ⇒ Object
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 |