On Jan 3, 2006, at 11:22 AM, gabriele renzi wrote:

> Ezra Zygmuntowicz ha scritto:
>> Hey rubyists-
>>     I was wondering if someone could help me make this small dsl I  
>> wrote  into a little bit better syntax. The Cond class just takes  
>> a block in  its constructor and converts what's inside the block  
>> into an sql  where clause with ? syntax like this:
>> c = Cond.new do
>>   first_name °∆=°«, °∆Ezra°«
>>   start_date °∆between°«, °∆2006-01-01°ž, °∆2006-01-30°ž
>>   last_name °∆like°«, °∆Zyg%°«
>>   sql °∆hosts.id = something.id'
>> end
>> p c.where
>> #=> ["first_name = ? and start_date between ? and ? and last_name   
>> LIKE ? and hosts.id = something.id", "Ezra", "2006-01-01",   
>> "2006-01-30", "Zyg%"]
>>     I would like to be able to get rid of the quotes around the   
>> operators '=', '<=', 'LIKE' and so on to become =, <= and LIKE .  
>> Also  I would like to be able to get rid of the need for commas  
>> inside the  block as well. Inside of the Cond class initialize  
>> method it justs  uses instance_eval &block to get the block  
>> contents and then uses  method_missing to build a nested array for  
>> each statement.
>
> look on RAA for the "Criteria" package, you may find it interesting  
> and a moe tested than your own. At least you can fish in it for  
> good ideas if you don't want to use it :)
>


Gabriele-

	Ahh thanks for that I will give it a look.


Cheers-
-Ezra