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

Reduce conversion of Symbol to String #642

Closed
wants to merge 6 commits into from

Conversation

ashmaroli
Copy link
Contributor

@ashmaroli ashmaroli commented Feb 20, 2020

Instead of interpolating :rouge (default and therefore more common scenario) to "rouge" multiple times when a Kramdown::Document is converted to_html, use a frozen_string to be used per instance.

Copy link
Owner

@gettalong gettalong left a comment

Thank you for your contribution!

If you can adapt your pull request as per my comments, I will merge it.

lib/kramdown/converter/html.rb Outdated Show resolved Hide resolved
lib/kramdown/converter/html.rb Outdated Show resolved Hide resolved
@gettalong
Copy link
Owner

@gettalong gettalong commented Apr 17, 2020

Perfect, thank you! I have squash-merged your changes and additionally, since the new @highlighter instance variable is only used in one place where it gets interpolated into a string, I have changed the instance variable to do the interpolation only once, saving additional string operations.

@gettalong gettalong closed this Apr 17, 2020
@ashmaroli
Copy link
Contributor Author

@ashmaroli ashmaroli commented Apr 17, 2020

have changed the instance variable to do the interpolation only once

That's even better!!

@ashmaroli ashmaroli deleted the interpolate-string branch Apr 17, 2020
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

2 participants