Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Return value of save, load and reload adapted.

  • Loading branch information...
commit ffb142f82a10edbc80fad19ee328250311b7cfa9 1 parent a43e647
Jan Friedrich authored
Showing with 8 additions and 1 deletion.
  1. +4 −0 lib/mini_exiftool.rb
  2. +4 −1 test/test_write.rb
View
4 lib/mini_exiftool.rb
@@ -32,6 +32,7 @@ def load filename
else
raise MiniExiftool::Error
end
+ self
end
def reload
@@ -79,14 +80,17 @@ def changed_tags
end
def save
+ result = false
@changed_values.each do |tag, val|
unified_tag = unify tag
converted_val = convert val
opt_params = converted_val.kind_of?(Numeric) ? '-n' : ''
cmd = %Q(#@prog -q -q -P -overwrite_original #{opt_params} -#{unified_tag}="#{converted_val}" "#{filename}")
run(cmd)
+ result = true
end
reload
+ result
end
private
View
5 test/test_write.rb
@@ -95,12 +95,15 @@ def test_save
temp_md5 = Digest::MD5.hexdigest(File.read(@temp_filename))
assert_equal org_md5, temp_md5
@mini_exiftool_num['Orientation'] = 2
- @mini_exiftool_num.save
+ result = @mini_exiftool_num.save
+ assert_equal true, result
org_md5_2 = Digest::MD5.hexdigest(File.read(@org_filename))
assert_equal org_md5, org_md5_2
temp_md5_2 = Digest::MD5.hexdigest(File.read(@temp_filename))
assert_not_equal temp_md5, temp_md5_2
assert_equal false, @mini_exiftool_num.changed?
+ result = @mini_exiftool_num.save
+ assert_equal false, result
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.