Closed
Description
Here's part of a rule I just wrote the other day:
stampfile_pattern = %r"^members/(?<email>.*)/\d{2}-(?<step>\w+).timestamp$"
rule stampfile_pattern do |t|
match = stampfile_pattern.match(t.name)
email = match[:email]
step = match[:step]
# ...
end
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:
stampfile_pattern = %r"^members/(?<email>.*)/\d{2}-(?<step>\w+).timestamp$"
rule stampfile_pattern do |t|
email = t.matchdata[:email]
step = t.matchdata[:step]
# ...
end
Before I dive in, what do you think? And is there another way to accomplish this that I've missed?
Metadata
Metadata
Assignees
Labels
No labels