Report abuse

class String
  def word_shorten ( length = 30 )
    if self.length >= length 
      short = self[0, length].split(/\s/)
      short[0, short.length-1].join(" ") + ' …'
    else 
      self
    end
  end
end

puts "Lorem ipsum dolor sit amet.".word_shorten(10)