Class: Guise::Registry

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

Instance Method Summary collapse

Constructor Details

#initializeRegistry

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