FWIW, I prefer to see the call stack used here, too; I suspect @adrienthebo meant something akin to:

<pre>
def execute_request(method, *args, depth = 0)
  raise "too many redirects" if depth > 10
  ...
  return response.redirect? ? execute_request(depth + 1, method, *args) : response
end
</pre>

(except, of course, with a varargs function, you can't have a default value in the last slot, making this ugly.)

Anyway, the principal is that you track depth as an argument passed to the function, not as mutated state inside the code.

(Though, er, em, I can't image why you used a *member* rather than just a local variable and a loop. :)