title: Static local variables for methods in Ruby?
body: <p>I have this:</p>
  
  <pre><code>def valid_attributes
    { :email =&gt; "some_#{rand(9999)}@thing.com" }
  end
  </code></pre>
  
  <p>For Rspec testing right? But I would like to do something like this:</p>
  
  <pre><code>def valid_attributes
    static user_id = 0
    user_id += 1
    { :email =&gt; "some_#{user_id}@thing.com" }
  end
  </code></pre>
  
  <p>I don't want <code>user_id</code> to be accessible from anywhere but that method,
  is this possible with Ruby?</p>