Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add a useful save! method.
  • Loading branch information
wilg authored and janfri committed Jul 9, 2012
1 parent c19eb37 commit 2c012c0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/mini_exiftool.rb
Expand Up @@ -184,6 +184,16 @@ def save
all_ok
end

def save!
unless save
err = []
self.errors.each do |key, value|
err << "(#{key}) #{value}"
end
raise "MiniExiftool couldn't save. The following errors occurred: #{err.empty? ? "None" : err.join(", ")}"
end
end

# Returns a hash of the original loaded values of the MiniExiftool
# instance.
def to_hash
Expand Down

0 comments on commit 2c012c0

Please sign in to comment.