def truncate(input, max = 30)
      return input if input.nil? || input.length <= max

      input[0..max - 1].gsub(/\s\w+\s*$/, '...')
    end
def truncate(input, max = 30)
      return input if input.nil? || input.length <= max

      input[0..max - 1].gsub(/\s\w+\s*$/, '...')
    end
Truncate the string received.

 @param  [String] input
         The string to truncate
 @param  [Number] max (Default: 30)
         The max size of the truncated string
 @return [String]