From: Meador Inge Date: 2006-07-26T00:29:43+09:00 Subject: Re: there has got to be a better way... ------=_Part_260412_9936195.1153841378194 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline How about: @t.rounds = Array.new(4) { Round.new } @t.rounds.each_index do |i| @t.rounds[@t.rounds.length - 1 - i] = Array.new(1 << i) { Match.new } end ? On 7/25/06, Michael Barinek wrote: > > i'm looking to simplify the below... > > @tournament.rounds = Array.new(4) { Round.new } > > @tournament.rounds[0].matches = Array.new(8) { Match.new } > @tournament.rounds[1].matches = Array.new(4) { Match.new } > @tournament.rounds[2].matches = Array.new(2) { Match.new } > @tournament.rounds[3].matches = Array.new(1) { Match.new } > > thoughts/suggestions? > > -- > Posted via http://www.ruby-forum.com/. > > ------=_Part_260412_9936195.1153841378194--