I have hash
and an array of hashes array
:
hash = {"BEGIN"=>5, "END"=>10}
array = [
{:name=>"aaa", :phase=>"END", :quantity=>6},
{:name=>"bbb", :phase=>"END", :quantity=>4},
{:name=>"ccc", :phase=>"BEGIN", :quantity=>5}
]
How can I calculate the percentage on the array of hashes taking the value from hash and get this result?
[
{:name=>"aaa", :phase=>"END", :quantity=>60%},
{:name=>"bbb", :phase=>"END", :quantity=>40%},
{:name=>"ccc", :phase=>"BEGIN", :quantity=>100%}
]
Thank you in advance!