Watch out for Ruby blocks scope gotcha
benjamin roth

What’s weird is that the initial code snippet you are sharing should not work either.

In your method, since you are assigning metrics_tracker = it becomes a local variable and cannot reference the metrics_tracker method below.

It looks like the problem comes from local variables vs methods rather than block scoping.