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

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -