diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-02-02 23:48:47 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-02-02 23:48:47 +0000 |
commit | 3fb12ca2c704d18d434b417d549122325e78225d (patch) | |
tree | b886c678f93853d5e0c344cf147bd537de9498b6 /ChangeLog | |
parent | 76e30fe50d52f22459954f2d93ed3621aaef267d (diff) |
Enhance the :requirements functionality in #map() to allow regexps with capturing groups: the first non-nil capture will be passed on as the corresponding parameter value, instead of the whole matched expression. See ChangeLog and documented source for details.
Diffstat (limited to 'ChangeLog')
-rw-r--r-- | ChangeLog | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -1,3 +1,26 @@ +2007-02-03 Giuseppe Bilotta <giuseppe.bilotta@gmail.com> + + * Plugin message mapper: Enhancements to the :requirements option. + When the requirement of a parameter is a regular expression with + capturing groups /(...)/, the corresponding map parameters will be + assigned (by default) the first non-nil capture instead of the whole + regular expression. If a specific capture group is desired instead, + the requirement should be in the form + [/some regexp/, integer_index_of_the_desired_group] + or in the form + { + :regexp => /some regexp/, + :index => integer_index_of_the_desired_group + } + and a nil index will still give the default behavior. + If you want the whole regular expression to be the matched parameter + value, there are three options: use an index of 0, wrap the whole + regular expression in a capturing group, or use non-capturing groups + /(?:...)/. The latter is preferred because it's much faster. + When exploiting the capturing groups feature, please try to remember + to use /\s+/ instead of plain spaces / /, unless it's absolutely + necessary to have single spaces. + 2007-02-02 Giuseppe Bilotta <giuseppe.bilotta@gmail.com> * Plugin message mapper: Requirements (as set by the :requirements |