------art_5384_6967961.1192834749984
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On 10/19/07, aa <aastanti / hotmail.com> wrote:

> Nevertheless, I'm still interested to know if anybody has ever
> composed different blocks together within the same iteration (and
> how).
>
> Thanks a lot.
> AA
>
>
> Do you mean something like this?

 def search_from(start)
   search_all proc {|s| s.creation > tart }
 end
 def search_to(_end)
   search_all proc {|s| s.creation < end }
 end
 def search(start, _end)
   search_all proc {|s| s.creation > tart }, proc { |s| s.creation < end
}
 end
 def search_all(*blocks)
   @list.select {|s|
     blocks.all? { |blk| blk.call(s) }
   }
 end

Unfortunately, you can't pass more than one block at a time - you have to
convert them to procs.

Regards,
Sean

------art_5384_6967961.1192834749984--