From: Matthew Harris Date: 2006-07-26T00:20:11+09:00 Subject: Re: there has got to be a better way... @tournament.rounds = Array.new(4) { Round.new } @tournaments.rounds.inject(8) do |size, round| round.matches = Array.new(size) { Match.new } size / 2 end Something like that? On 7/26/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/. > > -- Matt