This should be #map not #each

You want the result of the transformation, otherwise you'll inject the hash#to_s which results in an invalid config file.