Mega Code Archive

 
Categories / Ruby / Array
 

Fill an array of hashes

a = Array.new(2) { Hash.new } # Multiple instances p a[0]['cat'] = 'feline'