Skip to content

Commit

Permalink
Merge pull request #43 from prtngn/feature/fix_frozen_strings
Browse files Browse the repository at this point in the history
Feature/fix frozen strings
  • Loading branch information
janfri authored Dec 22, 2023
2 parents 1d96eb7 + de75ea8 commit a7d0010
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
3 changes: 3 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
2.10.5
- Fix a problem with frozen string in newer Ruby versions.

2.10.4
- Maintenance release.

Expand Down
32 changes: 15 additions & 17 deletions lib/mini_exiftool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# Simple OO access to the ExifTool command-line application.
class MiniExiftool

VERSION = '2.10.4'
VERSION = '2.10.5'

# Name of the ExifTool command-line application
@@cmd = 'exiftool'
Expand Down Expand Up @@ -147,14 +147,14 @@ def load filename_or_io
end
@values.clear
@changed_values.clear
params = '-j '
params << (@opts[:numerical] ? '-n ' : '')
params << (@opts[:composite] ? '' : '-e ')
params << (@opts[:coord_format] ? "-c #{escape(@opts[:coord_format])}" : '')
params << (@opts[:fast] ? '-fast ' : '')
params << (@opts[:fast2] ? '-fast2 ' : '')
params = ['-j']
params << ('-n' if @opts[:numerical])
params << ('-e' unless @opts[:composite])
params << ("-c #{escape(@opts[:coord_format])}" if @opts[:coord_format])
params << ('-fast' if @opts[:fast])
params << ('-fast2' if @opts[:fast2])
params << generate_encoding_params
if run(cmd_gen(params, @filename))
if run(cmd_gen(params.compact.join(' '), @filename))
parse_output
else
raise MiniExiftool::Error.new(@error_text)
Expand Down Expand Up @@ -225,14 +225,14 @@ def save
original_tag = MiniExiftool.original_tag(tag)
arr_val = val.kind_of?(Array) ? val : [val]
arr_val.map! {|e| convert_before_save(e)}
params = '-q -P -overwrite_original '
params << (arr_val.detect {|x| x.kind_of?(Numeric)} ? '-n ' : '')
params << (@opts[:ignore_minor_errors] ? '-m ' : '')
params = ['-q -P -overwrite_original']
params << (arr_val.detect {|x| x.kind_of?(Numeric)} ? '-n' : '')
params << (@opts[:ignore_minor_errors] ? '-m' : '')
params << generate_encoding_params
arr_val.each do |v|
params << %Q(-#{original_tag}=#{escape(v)} )
end
result = run(cmd_gen(params, temp_filename))
result = run(cmd_gen(params.compact.join(' '), temp_filename))
unless result
all_ok = false
@errors[tag] = @error_text.gsub(/Nothing to do.\n\z/, '').chomp
Expand Down Expand Up @@ -545,13 +545,11 @@ def escape val
end

def generate_encoding_params
params = ''
@@encoding_types.each do |enc_type|
@@encoding_types.map do |enc_type|
if enc_val = @opts[MiniExiftool.encoding_opt(enc_type)]
params << "-charset #{enc_type}=#{enc_val} "
"-charset #{enc_type}=#{enc_val}"
end
end
params
end.compact.join(' ')
end

# Backport YAML.unsafe_load
Expand Down
4 changes: 2 additions & 2 deletions mini_exiftool.gemspec
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# -*- encoding: utf-8 -*-
# stub: mini_exiftool 2.10.4 ruby lib
# stub: mini_exiftool 2.10.5 ruby lib
#
# This file is automatically generated by rim.
# PLEASE DO NOT EDIT IT DIRECTLY!
# Change the values in Rim.setup in Rakefile instead.

Gem::Specification.new do |s|
s.name = "mini_exiftool"
s.version = "2.10.4"
s.version = "2.10.5"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib"]
Expand Down

0 comments on commit a7d0010

Please sign in to comment.