On Sat, Feb 25, 2012 at 15:15, Valery Kvon <adda...@gmail.com> wrote:
> There must be code inside like that: > > if block_given? > yield index > end That wouldn't do the setting of the values in the array. Maybe: if block_given? size.times { |index| self << yield index } end or, if it already needs to loop over it to initialize the slot: size.times do |index| # do other initialization self << yield(index) if block_given? end -Dave -- Dave Aronson: Available Cleared Ruby on Rails Freelancer (NoVa/DC/Remote) -- see www.DaveAronson.com, and blogs at www.Codosaur.us, www.Dare2XL.com, www.RecruitingRants.com -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.