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

python - Writing Greek in matplotlib labels, titles -

c# - LINQ to Entities does not recognize the method 'Int32 IndexOf(System.String, System.StringComparison)' method -

Pygame memory leak with transform.flip -