Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Regexp literals in validations #1479

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Use Regexp literals in validations #1479

wants to merge 1 commit into from

Conversation

fdr
Copy link
Collaborator

@fdr fdr commented Apr 18, 2024

We used to store regular expressions as strings in the validations.rb which causes them to be compiled every time the validation is run. With this commit we are changing them to be stored as Regexp objects which are compiled only once at the load time.

We used to store regular expressions as strings in the validations.rb which
causes them to be compiled every time the validation is run. With this commit
we are changing them to be stored as Regexp objects which are compiled only
once at the load time.
@fdr fdr requested a review from byucesoy April 18, 2024 20:26
@fdr fdr marked this pull request as ready for review April 18, 2024 20:34
@enescakir
Copy link
Member

Does this PR conflict with this commit f6b4599

@fdr
Copy link
Collaborator Author

fdr commented Apr 19, 2024

It's actually based on and cherry picked :) (I even kept the author)

@fdr
Copy link
Collaborator Author

fdr commented Apr 19, 2024

I just figured using the appropriate ruby literal had Less Going On (escaping rules, even amount of evaluation on file load, though it's immaterial)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants