Closed pritambaral closed 2 years ago
Thanks for this, @pritambaral. I’m currently on parental leave so can’t promise to thoroughly review this just yet but it sounds like a useful addition.
Please feel free to ignore some of Hound CI’s automatic comments as they are not correct (e.g. the Hash syntax changes it proposes would break compatibility with older Ruby versions).
Has re2/set
been available since the earliest versions or do we need to detect support at compile time?
Has
re2/set
been available since the earliest versions or do we need to detect support at compile time?
Yes, it has been available since the earliest tag I could find on GitHub (2015-05-21), although that version is not API compatible with this PR. The last API breaking change happened in 2017, so I'm confident that the versions currently supported should work.
I've now removed the Hound webhook so it should no longer add noise to the review.
I've cleaned up the history and rolled these changes into 1.5.0 which should now be available from RubyGems.
Thank you for your contribution and extraordinary patience.
RE2::Set
allows for matching multiple patterns against a string. It scans the string only once and simultaneously checks for regexp matches against all patterns added to it. It is thus significantly faster than matching each pattern individually, which would require scanning the string once for every pattern.