"Joseph McDonald" <joe / vpop.net> writes:
> How do you declare an array of hashes?
You can't declare it directly. Instead, you allocate the hashes as you
go along, or pre-allocate them if you know how big the array will be:
SIZE = 100
a = Array.new(SIZE)
SIZE.times { |i| a[i] = Hash.new }
--or--
a = []
# then later
a[i] ||= Hash.new
a[i]['joe'] = ...
There's a rumor that the next version of Ruby will feature active
defaults, allowing you to do this kind of thing automatically.
Regards
Dave