title: Make sure a string starts or ends with another string in Rails
body: <p>Is there an easy way to apply the following logic to a string in Rails?</p>
  
  <pre><code>if string does NOT end with '.' then add '.'
  if string does NOT begin with 'http://' then add 'http://'.
  </code></pre>
  
  <p>Of course, one might do something like:</p>
  
  <pre><code>string[0..6] == 'http://' ? nil : (string = 'http://' + string)
  </code></pre>
  
  <p>But it is a little clunky and it would miss the <code>https://</code> alternative. Is there a nicer Rails way to do this?</p>