ruby number to human-readable string conversion

Posted by yaya3 on Stack Overflow See other posts from Stack Overflow or by yaya3
Published on 2010-06-14T14:10:51Z Indexed on 2010/06/14 16:42 UTC
Read the original article Hit count: 253

Filed under:
|

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]}"}

© Stack Overflow or respective owner

Related posts about ruby

Related posts about numbers