lundi 14 décembre 2020

Ruby efficient each loop

Is there a better way to write this? markdown is a StringIO

coverage_hash_arr.each do |the_hash|
    markdown << "------- Status on #{the_hash[:Module]} -------\n"
    the_hash.delete(:Module)
    the_hash.each {|key, value| markdown << "- #{key}: #{value} \n"} 
    markdown << "----------------------------------------------\n"
end

Aucun commentaire:

Enregistrer un commentaire