title: Ruby: substring to a certain length and also to last whitespace within substring
body: <p>I am trying to truncate a long string of text to a certain length, but want to also make sure that the truncated result ends at a whitespace. I am also going to append an ellipsis afterwards.</p>
  
  <p>For example this:</p>
  
  <pre><code>"This is a very long string that has more characters than I want in it."
  </code></pre>
  
  <p>becomes this:</p>
  
  <pre><code>"This is a very long string that..."
  </code></pre>
  
  <p>I am starting with this but obviously this doesn't deal with the problem of ending the string on whitespace.</p>
  
  <pre><code>&lt;%= item.description[0..30] %&gt;&amp;hellip;
  </code></pre>