Class: Guise::Registry
- Inherits:
-
Object
- Object
- Guise::Registry
- Defined in:
- lib/guise/registry.rb
Instance Method Summary collapse
- #[](name) ⇒ Object
- #[]=(name, definition) ⇒ Object
-
#initialize ⇒ Registry
constructor
A new instance of Registry.
Constructor Details
#initialize ⇒ Registry
Returns a new instance of Registry.
5 6 7 |
# File 'lib/guise/registry.rb', line 5 def initialize @registry = HashWithIndifferentAccess.new end |
Instance Method Details
#[](name) ⇒ Object
9 10 11 12 13 |
# File 'lib/guise/registry.rb', line 9 def [](name) @registry.fetch(name) do raise DefinitionNotFound.new(name) end end |
#[]=(name, definition) ⇒ Object
15 16 17 |
# File 'lib/guise/registry.rb', line 15 def []=(name, definition) @registry[name] = definition end |