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

Make the gem compatible with --enable-frozen-string-literal #679

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

casperisfine
Copy link

This option has been available for a very long time in Ruby, and will probably become the default in the semi-near future.

Ref: https://bugs.ruby-lang.org/issues/20205

This option has been available for a very long time in Ruby, and will
probably become the default in the semi-near future.

Ref: https://bugs.ruby-lang.org/issues/20205
@johnnyshields
Copy link
Collaborator

@casperisfine it's better to just add the magic comment to the top of every file. I think Rubocop autocorrect can do it.

@casperisfine
Copy link
Author

@johnnyshields I can do that if you prefer, that's no problem.

@johnnyshields
Copy link
Collaborator

@pitbulk are you ok with it?

@casperisfine
Copy link
Author

73b6683

@casperisfine
Copy link
Author

Hum, looks like String#+@ was only added in 2.3:

undefined method `+@' for "_":String (NoMethodError)

So I may need to use String#dup to preserve compatibility.

@johnnyshields
Copy link
Collaborator

I think we are overdue to drop Ruby less than 2.3, so can probably keep this PR as-is.

Also should be a single blank line after the magic comment.

NB: On Ruby 2.5 and 2.6, string literals with interpolation
are frozen too, which was changed in 2.7, hence why this commit
makes some changes to some code.
@casperisfine
Copy link
Author

Also should be a single blank line after the magic comment.

Done.

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