Bisa juga pake each_slice:
(1..10).each_slice(3) {|a| p a}
# outputs below
[1, 2, 3]
[4, 5, 6]
[7, 8, 9]
[10]
--
Hendy
2008/10/31 irfani YangBaikHati <[EMAIL PROTECTED]>
> pake modulus
>
> if id%5 == 0 break line
>
> doni wrote:
> >
> > kasus ini saya bingung pada saat mengatur photo
> >
> > yang saya inginkan output photo yaitu seperti ini
> >
> > (photo)|(photo) |(photo)| (photo)|( photo)| setelah 5 photo maka pindah
> > ke baris baru
> > (photo)|(photo) |(photo)| (photo)|( photo)|
> > (photo)|(photo) |(photo)| (photo)|( photo)|
> > (photo)|(photo) |(photo)| (photo)|( photo)|
> >
> > tapi hasilnya satu baris aja
> >
> > (photo)|(photo) |(photo)| (photo)|( photo)|(photo) |(photo)| (photo)|(
> > photo)|(photo) |(photo)|
> >
> > algoritma yang saya dapat :
> >
> > table
> > tr
> > td
> >
> > each.photo do |f|
> > print photo.f
> >
> > if f==5{
> >
> > print /tr
> > print tr
> > print td
> > }
> > end if
> > /td
> > /tr
> > /table
> >
> > yang saya bingung pada saat koding railsnya ...
> > mohon bantuan untuk kodingnya
> >
>
>
> --
> irfani
>
> http://irfani.web.id
> Y! irfani_s
>
>
>
> [Non-text portions of this message have been removed]
>
>
> ------------------------------------
>
> ID-Ruby
> Berdiskusi dan belajar bersama Bahasa Pemrograman Ruby, termasuk segala
> varian Ruby (JRuby, Rubinius, IronRuby, XRuby), dan program yang dibuat
> dengan Ruby (Ruby on Rails, JRuby on Rails, Merb)
>
> http://rubyurl.com/Q8DD
> http://news.gmane.org/gmane.comp.lang.ruby.region.indonesia
>
> Yahoo! Groups Links
>
>
>
>
[Non-text portions of this message have been removed]