dictionary - Create Ruby hash without `to_h` method -


I am trying to generate a key / value pair for all the letters of the English alphabet.

In Ruby 2.1, I can use it:

  ('a' .. 'z'). Each_with_index.to_h # = & gt; {"A" = & gt; 0, "b" = & gt; 1, "c" = & gt; 2, ...}   

However, in Ruby 1.9.x, the to_h method does not exist. What is the best solution for this matter?

Two Elements Array.

  Hush [('a' .. 'z'). Every_V_V_Nordac TOA]]    

Comments

Popular posts from this blog

c++ - Cmake produces file extensions in static library archives -

c# - Roxy file manager in MVC doesn't accept session path -

c# - XML - Serialize class - Some questions -