Author: Dan North
Rico is a container written in Ruby, demonstrating the same Inversion-of-Control principles as the Java Pico Container.
It is primarily a proof of concept at this stage - there is an embarrassingly small amount of actual code but it seems to cover the fundamentals.
The Constructor Injector IoC model depends on the signature of the constructor(s) of an object to identify its dependencies. Ruby does not have static types, so we use a list of keys to represent dependencies, passed in when we register a component.
require 'rico' # the main container
include Rico # so we don't need to use Rico:: everywhere
container = Rico.new
Rico has the same multicasting behaviour as Pico - you can call methods on a multicaster object and any registered components that understand the method will have it called. This is useful for lifecycle management.
Rico currently doesn't support the same ComponentAdapter model as Pico, which would bring it much more into line. Also we need a sample app or two to demonstrate how it works.