Class: Registry::Registries
- Inherits:
-
Object
- Object
- Registry::Registries
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/registry.rb
Instance Method Summary collapse
Instance Method Details
#[](key) ⇒ Object
18 19 20 21 22 |
# File 'lib/registry.rb', line 18 def [](key) registry = values.detect { |registry| registry.key?(key) } obj = registry[key] if registry obj || raise(UnknownKey, MSGS[:unknown] % [key, all_keys]) end |
#all_keys ⇒ Object
32 33 34 |
# File 'lib/registry.rb', line 32 def all_keys values.map(&:keys).flatten.sort end |
#registries ⇒ Object
28 29 30 |
# File 'lib/registry.rb', line 28 def registries @registries ||= Hash.new { |registries, key| registries[key] = Registry.new } end |
#registry(key) ⇒ Object
24 25 26 |
# File 'lib/registry.rb', line 24 def registry(key) registries[key] end |