if you look at the comments of this blog 
http://daniel.collectiveidea.com/blog/2007/7/10/a-prettier-truncate-helper 
you will find following code.


def truncate_words(text, length = 10, separator = ' ', truncate_string = 
'...')
  ' ' if text.nil?

  truncated_text = text.split[0..length].join(separator)

  if(truncated_text == text)
    text
  else
    truncated_text + ' ' + truncate_string
  end
end


I had never seen text.split[0..length] before. What's happening here. I 
always saw  split being passed an argument but never an array.
-- 
Posted via http://www.ruby-forum.com/.