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

Bump version patch #1874

Merged
merged 2 commits into from
Dec 17, 2024
Merged

Bump version patch #1874

merged 2 commits into from
Dec 17, 2024

Conversation

bahar-p
Copy link
Member

@bahar-p bahar-p commented Dec 17, 2024

  • Fast follow on Fix bug in tokenizer with nil source value #1873 after digging further and getting more clarity on the why. Brought back the double string conversion, to_s.to_str. See the comment as to why.

  • Bump the version. Next minor release will be 5.6.0, bumping the patch version for semver compliance. I also added the latest fix in the Changelog for the release candidate. I'm sure there has been more if you have context feel free to add the update there.

@bahar-p bahar-p requested review from ianks and alexcoco December 17, 2024 16:55
@@ -5,7 +5,7 @@ class Tokenizer
attr_reader :line_number, :for_liquid_tag

def initialize(source, line_numbers = false, line_number: nil, for_liquid_tag: false)
@source = source.to_s
@source = source.to_s.to_str
Copy link
Member Author

@bahar-p bahar-p Dec 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For posterity:

This is necessary to handle cases where to_s returns a subclass of String but we explicitly want to turn it into an instance of String.

As stated in this PR, ActiveSupport::SafeBuffer is one that we need to handle. It is a subclass of String. Calling ActiveSupport::SafeBuffer#to_s returns self (an instance of safe_buffer) however, what we actually want is an instance of String. Calling to_str ensures we're always dealing with an instance of String

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just do?

Suggested change
@source = source.to_s.to_str
@source = source.to_str

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bahar-p bahar-p merged commit 94e02d7 into main Dec 17, 2024
11 checks passed
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.

3 participants