title: How to check if a string contain valid hash
body: <p>i encounter a problem when i want to validate the input string if it contain a valid hash before execute eval on it, for example:</p>
  
  <p><code>"{:key=&gt;true}"</code> if i run eval it return a correct hash, but if i run eval on this string <code>"{:key=&gt;true"</code> i get syntax error of expected token:</p>
  
  <pre><code>(eval):1: syntax error, unexpected end-of-input, expecting '}' {:redirect=&gt;true ^
  </code></pre>
  
  <p>i did tried some basic validation but no luck so far.</p>
  
  <p>so basically what i want to know is how to validate a that a string contain correct hash format.</p>