-
Notifications
You must be signed in to change notification settings - Fork 313
Fix frozen error caused by frozen string literal #431
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
Conversation
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.
Good spot, thanks!
All but one of these changes look good to me (see comment).
lib/zip/file.rb
Outdated
@@ -402,7 +402,7 @@ def get_entry(entry) | |||
# Creates a directory | |||
def mkdir(entryName, permissionInt = 0o755) | |||
raise Errno::EEXIST, "File exists - #{entryName}" if find_entry(entryName) | |||
entryName = entryName.dup.to_s | |||
entryName = +entryName.to_s |
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.
entryName = +entryName.to_s | |
entryName = entryName.dup.to_s |
I am not sure about this one --- I think the dup
here is not necessarily to get an unfrozen entryName
but instead to avoid mutating the entryName
argument. +
does not duplicate the string if it's not frozen.
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.
@jaredbeck ,
Thank you for your comment !
OK, I will revert this change.
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.
Done!
(And I have not forgotten about our discussion in #390 (comment) --- we should really get that linter set up!) |
@jdleesmiller I have a branch in my local repo where I've done a ton of work getting rubocop up to date. I'll try and get that sorted and get a PR out this weekend. |
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.
Thanks 👍
Hi,
I got
FrozenError
when I use rubyzip gem --enable-frozen-string-literal option.This PR is to fix the above error.