ruby - Convert two arrays into an array of Hash pairs -


i have 2 arrays:

dates = [1,2,3] values = [10,20,30] 

how can combine them this?

[{date:1,value:10},{date:2,value:20}...etc] 

dates.zip(values).map{|k, v| {date: k, value: v}} 

Comments

Popular posts from this blog

amazon web services - S3 and apache mod_proxy with basic authentication -

How to install ruby on rails -

powershell - This solution contains one or more assemblies targeted for the global assembly cache -