Dic
Simple Dependency injection container
Example
require 'dic'
class MyDic < Dic
def initialize
super
# set name to 'Thomas'
name 'Thomas'
# use proc to computer values lazily
answer { long_computation() }
# properties can be defined in any order
upfoo { foo.upcase }
foo { 'bar' }
# you can use #set
set answer, 42
end
end
mc = MyDic.new
mc.foo # => 'bar'
mc[:foo] # => 'bar'