daddyz / phonelib

Ruby gem for phone validation and formatting using google libphonenumber library data
MIT License
1.08k stars 132 forks source link

Prepares for Ruby to freeze all strings #312

Closed radville closed 3 months ago

radville commented 3 months ago

There was a deprecation warning for chilled strings merged recently in Ruby: https://github.com/ruby/ruby/commit/12be40ae6be78ac41e8e3f3c313cc6f63e7fa6c4

And with that we started to see the following warning coming from phonelib:

vendor/gems/3.4.0/ruby/3.4.0+0/gems/phonelib-0.8.3/lib/phonelib/phone.rb:27: warning: literal string will be frozen in the future

These changes remove those errors by unfreezing strings when they should be mutable. They get the test suite to pass with RUBYOPT="--enable-frozen-string-literal", which will be the default in the future.

radville commented 3 months ago

Largely a duplicate of https://github.com/daddyz/phonelib/pull/305