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# - The item with identity 'Id' already exists in the metadata collection. Parameter name: item -

sql - PostgreSQL automatically update row at specific date -

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