While reading Yehuda Katz’ blog post concerning mental models about Ruby’s behavior, I was a bit rankled by his reference to implicit locals created by running regular expressions with match clauses.
I was nearly certain that the dollar-sign prefix on the variables ensured the variables were global, but had to verify for myself.
Surprisingly, I found that the matches truly were local.
span class="st0">"hello""goodbye"span class="co0">#<MatchData "h">, [nil, #<MatchData "g" 1:"g">, "g"], nil]
Leave a Comment