Convert hash to array : Convert to Array « Hash « Ruby






Convert hash to array


myHash = { 1920 => "value for 1920", 1925 => "value for 1925", 1934 => "value for 1934" }
myHash.to_a # => [[1925, "value for 1925"], [1920, "value for 1920"], [1934, "value for 1934"]]

 

Related examples in the same category