title: Ruby function as value of hash
body: <p>I was wondering if or how it is possible to map a function to a value of a hash.</p>
  
  <p>For example:
  ----Start Class------------</p>
  
  <pre><code>def foo(var)
      return var + 2
  end
  
  hash_var = { func =&gt; foo() }
  </code></pre>
  
  <p>----End Class--------------</p>
  
  <p>so that I could later call </p>
  
  <pre><code>Class::hash_var["func"][10]
  </code></pre>
  
  <p>or </p>
  
  <pre><code>Class::hash_var["func"](10)
  </code></pre>
  
  <p>and that would return 12?</p>