Sha256: 612794461190f75c058e0811a6163c9bf3e1f8d051458c7ec9c1f5e6a50062cc

Contents?: true

Size: 939 Bytes

Versions: 1

Compression:

Stored size: 939 Bytes

Contents

# Naive implementation of IO wrapper class that adds mime_type and original_filename
# attributes. This is done to match the interface of ActionDispatch::HTTP::UploadedFile
# so the attributes do not have to be passed as additional arguments, and are attached
# properly to the object they describe.
#
#
#  Use SimpleDelegator to wrap the given class or instance
require 'delegate'

module Hydra
  module Derivatives
    class IoDecorator < SimpleDelegator
      extend Deprecation

      attr_accessor :mime_type, :original_filename
      alias original_name original_filename
      deprecation_deprecate original_name: 'original_name has been deprecated. Use original_filename instead. This will be removed in hydra-derivatives 4.0'

      def initialize(file, mime_type = nil, original_filename = nil)
        super(file)
        self.mime_type = mime_type
        self.original_filename = original_filename
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hydra-derivatives-3.4.0 lib/hydra/derivatives/io_decorator.rb