From: Ben Zealley Date: 2006-07-21T03:35:11+09:00 Subject: Using .each with constructors Is there a nice elegant way of creating several named objects of the same class? I naively tried a,b,c,d = 0 [a, b, c, d].each { |o| o = SomeClass.new } and found that while they get initialised inside the block, they get destroyed leaving it. I can't believe a = SomeClass.new b = SomeClass.new etc. is the best way to do it. I can populate an array, but let's hypothesise that for reasons relating to irritating corporate coding standards, the variables need specific names... ;) Thoughts appreciated! Cheers -- Ben