wycats/thor — Issue #207: gsub_file with block, no access to $1 etc?
Author: jrochkind
Created: 2011-12-28 16:21:06+00:00
State: open

When using gsub_file action with a block, if the expression matched had paren grouping, it seems you ought to be able to access $1 etc in the block, to construct your replacement string.

Looking at the source code, it still seems like this should work -- the block passed in to gsub_file is passed to ordinary String#gsub!, which definitely makes $1 etc available in the block.

And yet, I can not get this to work. (0.14.6, in context of a Rails 3.1 generator). $1 is always nil, even if there was a matching paren group in the regexp.

Anyone have any idea what's going on?