Sha256: 8b2463f0b0ff3d7d6454bf7d3126118f056c821e17db77cf1d081e37703e31a4
Contents?: true
Size: 975 Bytes
Versions: 1
Compression:
Stored size: 975 Bytes
Contents
# # File 'container.rb' created on 15 ago 2008 at 15:16:11. # # See 'dokkit.rb' or +LICENSE+ for license information. # # (C)2006-2008 Andrea Fazzi <andrea.fazzi@alca.le.it> (and contributors). # module Dokkit module Environment class Container def initialize @registry = { } @instances = { } end def method_missing(meth) self[meth] end def [](service_name) @instances[service_name] || (@instances[service_name] = @registry[service_name].call) end def register(service_name, &blk) @instances[service_name] = nil @registry[service_name] = blk end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dokkit-0.5.0 | lib/dokkit/environment/container.rb |