Here's part of a rule I just wrote the other day:
stampfile_pattern=%r"^members/(?<email>.*)/\d{2}-(?<step>\w+).timestamp$"rulestampfile_patterndo |t|
match=stampfile_pattern.match(t.name)email=match[:email]step=match[:step]# ...endNotice how, after it matches, I have to re-apply the regex inside the rule definition in order to pull out named matchdata.
I was thinking of introducing something like this as an alternative:
stampfile_pattern=%r"^members/(?<email>.*)/\d{2}-(?<step>\w+).timestamp$"rulestampfile_patterndo |t|
email=t.matchdata[:email]step=t.matchdata[:step]# ...endBefore I dive in, what do you think? And is there another way to accomplish this that I've missed?
Here's part of a rule I just wrote the other day:
Notice how, after it matches, I have to re-apply the regex inside the rule definition in order to pull out named matchdata.
I was thinking of introducing something like this as an alternative:
Before I dive in, what do you think? And is there another way to accomplish this that I've missed?