-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Bump version patch #1874
Conversation
9815acd
to
60701f8
Compare
@@ -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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just do?
@source = source.to_s.to_str | |
@source = source.to_str |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to_str
is only defined on String: https://docs.ruby-lang.org/en/3.3/String.html#method-i-to_str
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.