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

asp.net - Procedure or function "Procedure name" expects a parameter "Param name" which was not supplied occurs rarely -

jsp - No mapping found for HTTP request with URI with annotation config Spring MVC and Jetty -

sql server ce - Is there some way to make sqlce3.5 and 4.0 co-exist in the C# project -