strings
strings copied to clipboard
Issue with unicode_utils gem
Hi there!
strings
depends on unicode_utils
(https://github.com/piotrmurach/strings/blob/master/strings.gemspec#L27)
unicode_utils
is not compatible with frozen_string_literal
https://github.com/lang/unicode_utils/issues/13 and don't seem to be maintained 😢
And so it breaks with :
/Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/ruby/3.3.0/gems/unicode_utils-1.4.0/lib/unicode_utils/read_cdata.rb:124:in `force_encoding': can't modify frozen String: "x", created at /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/ruby/3.3.0/gems/unicode_utils-1.4.0/lib/unicode_utils/read_cdata.rb:123 (FrozenError)
Because I've enabled frozen-string-literal
globally in my Rails project :
export RUBYOPT="--enable=frozen-string-literal --debug=frozen-string-literal"
See: https://gist.github.com/fxn/bf4eed2505c76f4fca03ab48c43adc72
A solution would be to vendor/include what you need from unicode_utils
:
https://github.com/piotrmurach/strings/blob/master/lib/strings/truncate.rb#L5 https://github.com/piotrmurach/strings/blob/master/lib/strings/wrap.rb#L5
https://github.com/lang/unicode_utils/blob/master/lib/unicode_utils/each_grapheme.rb https://github.com/lang/unicode_utils/blob/master/lib/unicode_utils/read_cdata.rb
Thank you!