title: How do I call a method that is a hash value?
body: <p>Previously, I asked about a clever way to execute a method on a given condition "<a href="https://stackoverflow.com/questions/1061177/ruby-a-clever-way-to-execute-a-function-on-a-condition">Ruby a clever way to execute a function on a condition</a>."</p>
  
  <p>The solutions and response time was great, though, upon implementation, having a hash of lambdas gets ugly quite quickly. So I started experimenting.</p>
  
  <p>The following code works:</p>
  
  <pre><code>def a()
    puts "hello world"
  end
  
  some_hash = { 0 =&gt; a() }
  
  some_hash[0]
  </code></pre>
  
  <p>But if I wrap this in a class it stops working:</p>
  
  <pre><code>class A
  
    @a = { 0 =&gt; a()}
  
    def a()
      puts "hello world"
    end
  
  
    def b()
      @a[0]
    end
  
  end
  
  d = A.new()
  
  d.b()
  </code></pre>
  
  <p>I can't see why it should stop working, can anyone suggest how to make it work?</p>