lib/tiff.rb in exifr-0.10.4 vs lib/tiff.rb in exifr-0.10.5
- old
+ new
@@ -236,11 +236,11 @@
})
IFD_TAGS = [:image, :exif, :gps] # :nodoc:
time_proc = proc do |value|
if value =~ /^(\d{4}):(\d\d):(\d\d) (\d\d):(\d\d):(\d\d)$/
- Time.mktime($1, $2, $3, $4, $5, $6) rescue nil
+ Time.mktime($1.to_i, $2.to_i, $3.to_i, $4.to_i, $5.to_i, $6.to_i) rescue nil
else
value
end
end
@@ -256,17 +256,17 @@
end
# Rotate and/or flip for proper viewing.
def transform_rmagick(img)
case @type
- when :TopRight : img.flop
- when :BottomRight : img.rotate(180)
- when :BottomLeft : img.flip
- when :LeftTop : img.rotate(90).flop
- when :RightTop : img.rotate(90)
- when :RightBottom : img.rotate(270).flop
- when :LeftBottom : img.rotate(270)
+ when :TopRight ; img.flop
+ when :BottomRight ; img.rotate(180)
+ when :BottomLeft ; img.flip
+ when :LeftTop ; img.rotate(90).flop
+ when :RightTop ; img.rotate(90)
+ when :RightBottom ; img.rotate(270).flop
+ when :LeftBottom ; img.rotate(270)
else
img
end
end
@@ -416,15 +416,17 @@
def next
IFD.new(@data, @offset_next) unless @offset_next == 0 || @offset_next >= @data.size
end
def to_yaml_properties
- '@fields'
+ ['@fields']
end
+
private
def add_field(field)
return unless tag = TAG_MAPPING[@type][field.tag]
+ return if @fields[tag]
if IFD_TAGS.include? tag
@fields[tag] = IFD.new(@data, field.offset, tag)
else
value = field.value.map { |v| ADAPTERS[tag][v] } if field.value
@@ -467,10 +469,10 @@
end
end
if len && pack
start = len > 4 ? @offset : (pos + 8)
- @value = pack[data[start..(start + len - 1)]]
+ @value = [pack[data[start..(start + len - 1)]]].flatten
end
end
end
end
end
\ No newline at end of file