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: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: +1 (from 1 vote)
Facebook Twitter Email

Leave a Reply