tags:

views:

69

answers:

2

I need to have a list with id's for each list item being #one, #two etc. Is this the most efficient way or am I missing an in built ruby function here?

-num_array = ["one", "two", "three", "four", "five", "six", "seven"]
-navigation[:primary_level].each_with_index do |primary_item, idx|
   %li{ :id => "#{num_array[idx]}"}
+1  A: 

I'm sure this goes well beyond what you need, but there's code to do that at Rosetta Code

glenn jackman
Cool - I'll use that if I need it on a large scale. From this answer I am assured that the answer is "No, this functionality is not already available in the native ruby classes". Thanks
Dr. Frankenstein
+1  A: 

The humanize gem converts digits into words.

Andrew Grimm
Nice - this looks like the best tool for the job to me, should I need it.
Dr. Frankenstein