From: Joel VanderWerf Date: 2005-04-20T04:14:41+09:00 Subject: Re: Needle and Parameterized Services Rob Lally wrote: > Hi, > > I've been using Needle to try to create an iBatis like framework in > Ruby. I want register parameterized blocks but when I do this they have > to take the container and service point as the first two parameters. At > least I think they need to ... I'm hoping they don't, can anyone suggest > a way round it? It's not Needle, but MinDI does have parameterized services with the same signature for both the service definition and invocation. See http://raa.ruby-lang.org/project/mindi. Example: ----------- require 'mindi' class SimpleContainer extend MinDI::Container string { "Hello, world\n" } point_at { |x,y| [x,y] } stuff { [string, point_at(100,200)] } end cont = SimpleContainer.new p cont.stuff # ==> ["Hello, world\n", [100, 200]] ----------- MinDI is only about 100LOC and ruby licensed, so you can hack away...