Skip to content
This repository
Browse code

Add a useful save! method.

  • Loading branch information...
commit 2c012c02f89ab5101b73946a6511c1d7f1eed357 1 parent c19eb37
Wil Gieseler authored July 06, 2012 janfri committed July 09, 2012

Showing 1 changed file with 10 additions and 0 deletions. Show diff stats Hide diff stats

  1. 10  lib/mini_exiftool.rb
10  lib/mini_exiftool.rb
@@ -184,6 +184,16 @@ def save
184 184
     all_ok
185 185
   end
186 186
 
  187
+  def save!
  188
+    unless save
  189
+      err = []
  190
+      self.errors.each do |key, value|
  191
+        err << "(#{key}) #{value}"
  192
+      end
  193
+      raise "MiniExiftool couldn't save. The following errors occurred: #{err.empty? ? "None" : err.join(", ")}"
  194
+    end
  195
+  end
  196
+
187 197
   # Returns a hash of the original loaded values of the MiniExiftool
188 198
   # instance.
189 199
   def to_hash

0 notes on commit 2c012c0

Please sign in to comment.
Something went wrong with that request. Please try again.