What is the simplest way to convert the range 1..10 into a hash of the following format?
{
1 => '£1',
2 => '£2',
# ...
}
I have tried doing this with map, but end up with an array of hashes rather than a single hash.
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
or
or in Ruby 1.9