title: How to change a Ruby Class Variable value
body: <p>I'm new to Ruby and I what I want to do is the following</p>
  
  <pre><code>class WS&lt; ActiveRecord::Base
    @@SequenceNumber = 0
  
    def self.oper1
      @@SequenceNumber = 2
    end
  
    def self.oper2
     @@SequenceNumber += 1 
     puts @@SequenceNumber.to_s
    end
  
    def self.oper3
     puts @@SequenceNumber.to_s
    end
  end
  </code></pre>
  
  <p>If I do something like:</p>
  
  <pre><code>WS.oper1
  WS.oper2
  WS.oper3
  </code></pre>
  
  <p>I get the following output:</p>
  
  <pre><code>3
  2
  </code></pre>
  
  <p>Why isn't my @@SequenceNumber += 1 working? What am I doing wrong?</p>
  
  <p>Thank you.</p>