Sha256: 59fa2b18034c28543068f7ff4b899b26ab45203150df402ed85fa2b96742f530

Contents?: true

Size: 447 Bytes

Versions: 7

Compression:

Stored size: 447 Bytes

Contents

module Hydra::Works
  class DetermineOriginalName
    # Determines the original name for a given file
    # @param [IO, File, Rack::Multipart::UploadedFile] 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

7 entries across 7 versions & 1 rubygems

Version Path
hydra-works-2.2.0 lib/hydra/works/services/determine_original_name.rb
hydra-works-2.1.0 lib/hydra/works/services/determine_original_name.rb
hydra-works-2.0.0 lib/hydra/works/services/determine_original_name.rb
hydra-works-1.2.0 lib/hydra/works/services/determine_original_name.rb
hydra-works-1.1.0 lib/hydra/works/services/determine_original_name.rb
hydra-works-1.0.0 lib/hydra/works/services/determine_original_name.rb
hydra-works-0.17.0 lib/hydra/works/services/determine_original_name.rb