How to initialize an Array of Hashes in Ruby

How to initialize an array of hashes. Each value of keys within the hash will initially consist of an empty array:


your_hash = Hash.new {|h,k| h[k] = [] }

VN:F [1.9.22_1171]
Rating: 5.0/5 (3 votes cast)
VN:F [1.9.22_1171]
Rating: +5 (from 5 votes)
How to initialize an Array of Hashes in Ruby, 5.0 out of 5 based on 3 ratings
Facebook Twitter Email

Leave a Reply