janfri / mini_exiftool

This library is a wrapper for the Exiftool command-line application (https://exiftool.org) written by Phil Harvey. It provides the full power of Exiftool to Ruby: reading and writing of EXIF-data, IPTC-data and XMP-data. Branch master is for actual development and branch compatibility-version is for compatibility with Ruby 1.8 and exiftool versions prior 7.65.
GNU Lesser General Public License v2.1
213 stars 52 forks source link

Feature/fix frozen strings #43

Closed prtngn closed 10 months ago

prtngn commented 1 year ago

Hi. I have a problem with frozen strings. This is PR fix it.

janfri commented 11 months ago

On which Ruby version does it not work?

prtngn commented 11 months ago

On which Ruby version does it not work?

Ruby is 3.1.1. This problem occurs when the global Frozen Litteral Strings flag is set at the project level.

prtngn commented 11 months ago

And this PR is not full ) I still need to improve it.

janfri commented 10 months ago

How about to add a line # frozen_string_literal: false at the top of mini_exiftool.rb? Then it should work when frozen_string_literal is globally set to true in your application.

I'm afraid that your optimizations could be counter productive, since you introduze arrays to avoid manipulation of Strings. It seems that setting frozen_string_literal to true is not so effective how it seems at the first think. See mame's reply: https://bugs.ruby-lang.org/issues/11473#note-59.

prtngn commented 10 months ago

Yes, # frozen_string_literal: false one of the solutions to the problem