title: Ruby method for +=
body: <p>Is there a way to make Ruby able to do something like this?</p>
  
  <pre><code>class Plane
    @moved = 0
    @x = 0
    def x+=(v) # this is error
      @x += v
      @moved += 1
    end
    def to_s
      "moved #{@moved} times, current x is #{@x}"
    end
  end
  
  plane = Plane.new
  plane.x += 5
  plane.x += 10
  puts plane.to_s # moved 2 times, current x is 15
  </code></pre>