Sha256: 4f87944ba31b58a97c36a65b3eb92be4e50c622ccccbeed477b03df665929221

Contents?: true

Size: 454 Bytes

Versions: 3

Compression:

Stored size: 454 Bytes

Contents

module Hydra::Works
  class DetermineOriginalName
    # Determines the original name for a given file
    # @param [IO, File, Rack::Multipart::UploadedFile, #read] file
    # @return [String]
    def self.call(file)
      return file.original_name if file.respond_to?(:original_name)
      return file.original_filename if file.respond_to?(:original_filename)
      return ::File.basename(file.path) if file.respond_to?(:path)
      ''
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hydra-works-0.16.0 lib/hydra/works/services/determine_original_name.rb
hydra-works-0.15.0 lib/hydra/works/services/determine_original_name.rb
hydra-works-0.14.0 lib/hydra/works/services/determine_original_name.rb