def truncate(string, options = {})
      length = options[:length] || 30

      if string.length > length
        string[0..length - 3] + "..."
      else
        string
      end
    end
def truncate(string, options = {})
      length = options[:length] || 30

      if string.length > length
        string[0..length - 3] + "..."
      else
        string
      end
    end
Truncate the given string to a certain number of characters.

 @param [String] string
   the string to truncate
 @param [Hash] options
   the list of options (such as +length+)