2010/2/15 John Ydil <john.gendrot / cnsi.fr>:
> John Ydil wrote:
>>
>>>
>>> Slowly.... =A0I believe #each_slice was added later as well. =A0Oh well=
.
>>> Can't you just upgrade your Ruby version? =A0That seems a much better
>>> option than trying to retrofit all the new behavior on the old
>>> version.
>>>
>>> Kind regards
>>>
>>> robert
>>
>> I'll try to upgrade.
>
>
> Unfortunately, the provider doesn't have a newer version of ruby :s

module Enumerable
  def each_slice(num)
    sl =3D []

    each do |x|
      sl << x

      if sl.size =3D=3D num
        yield sl
        sl =3D []
      end
    end

    yield sl unless sl.empty?

    self
  end
end

Kind regards

robert


--=20
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/