配列をハッシュに変換しています。キーはインデックスで、値はそのインデックスの要素です。
これが私がやった方法です
# initial stuff
arr = ["one", "two", "three", "four", "five"]
x = {}
# iterate and build hash as needed
arr.each_with_index {|v, i| x[i] = v}
# result
>>> {0=>"one", 1=>"two", 2=>"three", 3=>"four", 4=>"five"}
それを行うためのより良い(「より良い」という言葉の意味で)方法はありますか?