Skip to content

Commit

Permalink
Fix for "can't add a new key into hash during iteration"
Browse files Browse the repository at this point in the history
  • Loading branch information
metanest committed Apr 7, 2010
1 parent 5a08fc2 commit 597f935
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/tiff.rb
Expand Up @@ -408,12 +408,19 @@ def to_hash
@hash ||= begin
result = @fields.dup
result.delete_if { |key,value| value.nil? }
tmp = {}
delkeys = []
result.each do |key,value|
if IFD_TAGS.include? key
result.merge!(value.to_hash)
result.delete key
tmp.merge!(value.to_hash)
delkeys << key
end
end
delkeys.each {|key|
result.delete(key)
}
result.merge!(tmp)
result
end
end

Expand Down

0 comments on commit 597f935

Please sign in to comment.