lib/assembly-objectfile/object_fileable.rb in assembly-objectfile-1.10.0 vs lib/assembly-objectfile/object_fileable.rb in assembly-objectfile-1.10.1
- old
+ new
@@ -5,10 +5,11 @@
module Assembly
# Common behaviors we need for other classes in the gem
module ObjectFileable
attr_accessor :file_attributes, :label, :path, :provider_md5, :provider_sha1, :relative_path, :mime_type_order
+
VALID_MIMETYPE_METHODS = %i[exif file extension].freeze
# @param [String] path full path to the file to be worked with
# @param [Hash<Symbol => Object>] params options used during content metadata generation
# @option params [Hash<Symbol => ['yes', 'no']>] :file_attributes e.g. {:preserve=>'yes',:shelve=>'no',:publish=>'no'}, defaults pulled from mimetype
@@ -85,15 +86,15 @@
# @example
# source_file = Assembly::ObjectFile.new('/input/path_to_file.tif')
# puts source_file.exif # hash with exif information
def exif
@exif ||= begin
- check_for_file
- MiniExiftool.new(path, replace_invalid_chars: '?')
- rescue StandardError
- nil
- end
+ check_for_file
+ MiniExiftool.new(path, replace_invalid_chars: '?')
+ rescue StandardError
+ nil
+ end
end
# Computes md5 checksum or returns cached value
# @return [String] md5 checksum
# @example
@@ -206,10 +207,10 @@
# source_img = Assembly::ObjectFile.new('/input/path_to_file.tif')
# puts source_img.valid_image? # true
def valid_image?
return false unless image?
- mimetype == 'image/jp2' || jp2able? ? true : false
+ mimetype == 'image/jp2' || jp2able?
end
# @return [Boolean] true if image has a color profile, false if not.
# @example
# source_img = Assembly::ObjectFile.new('/input/path_to_file.tif')