wycats/thor — pull request #217 by kentaroi (2012-02-05 04:18:31+00:00)
Title: A proposal for Actions#gsub_file

Here is a patch we discussed with @jrochkind on issue #207

This change would make capturing groups accessible from a block of gsub_file, such as:

gsub_file(file_path, regexp) { |*match| match[2].upcase }
gsub_file(file_path, regexp) { |m0, m1, m2| m2.upcase }

the above two lines will get same results.

Also you can use the old style with a single block parameter, such as:

gsub_file(file_path, regexp) { |match| match.gsub(/__/, '').upcase }

However, the following are still not accessible:
1. named capturing groups
2. pre_match
3. post_match