class Dee::Container
Public Class Methods
new()
click to toggle source
# File lib/dee/container.rb, line 25 def initialize @values = Hash.new end
Public Instance Methods
[](key)
click to toggle source
# File lib/dee/container.rb, line 37 def [](key) raise "'%s' is not defined in container" % key unless @values.key? key value = @values[key] if value.kind_of? Factory value.create else value end end
[]=(key, value)
click to toggle source
# File lib/dee/container.rb, line 49 def []=(key, value) @values[key] = value end
factory(key, &block)
click to toggle source
# File lib/dee/container.rb, line 29 def factory(key, &block) @values[key] = Factory.new(&block) end
singleton(key, &block)
click to toggle source
# File lib/dee/container.rb, line 33 def singleton(key, &block) @values[key] = SingletonFactory.new(&block) end