I am new to ruby. My requirement is simple . I have 3 arrays min ,max and regions. I want to create a hash for each region with corresponding min and max value ..something like
{"Region1"=>["100", "500"], "Region 2"=>["200", "300"] ...}
where
regions=["Region 1","Region 2",....]
min=["100","200",...]
max=["500","300",...]
where 100 ,500 is min and max values from array.
Here is my code
@min=params[:min]
@max=params[:max]
@regions=params[:regions]
I have tried this so far..but didnt work
@range_map = Hash[@regions.map{|r| [r, [@min.each.to_i,@max.each.to_i]]}]
All I want is a hash from 3 array and min and max to be converted to integer . Thanks
Aucun commentaire:
Enregistrer un commentaire