Convert Ruby array of tuples into a hash given an array of keys?
- by Kit Ho
I have an simple array
array = ["apple", "orange", "lemon"]
array2 = [["apple", "good taste", "red"], ["orange", "bad taste", "orange"], ["lemon" , "no taste", "yellow"]]
how can i convert in to this hash whenever element in array match the first element of each element in array2?
hash = {"apple" => ["apple" ,"good taste", "red"],
…