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

String#sub instead String#gsub. Faster code. #1793

Merged
merged 1 commit into from Oct 23, 2014
Merged

String#sub instead String#gsub. Faster code. #1793

merged 1 commit into from Oct 23, 2014

Conversation

glaucocustodio
Copy link
Contributor

Sub replaces only the first occurrence, while gsub all. More info at https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringsub-code.

@nesquena
Copy link
Member

In each of these cases, have you confirmed that these tokens need to only be replaced once within the templates?

@glaucocustodio
Copy link
Contributor Author

I built and installed the padrino-gen with this commit and generated a project (with proper database.rb) locally successfully. You can check that there is just one token to be replaced in each sub occurrence.

@namusyaka
Copy link
Contributor

Looks good, thanks!

namusyaka added a commit that referenced this pull request Oct 23, 2014
String#sub instead String#gsub. Faster code.
@namusyaka namusyaka merged commit 7819577 into padrino:master Oct 23, 2014
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

3 participants