James Gray
7/20/2006 6:49:00 PM
On Jul 20, 2006, at 1:35 PM, Ben Zealley wrote:
> 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 }
>> a, b, c, d = Array.new(4) { |i| String.new(i.to_s) }
=> ["0", "1", "2", "3"]
Hope that helps.
James Edward Gray II