Class: Paperclip::UploadedFileAdapter

Inherits:
AbstractAdapter show all
Defined in:
lib/paperclip/io_adapters/uploaded_file_adapter.rb

Constant Summary

Constants inherited from AbstractAdapter

AbstractAdapter::OS_RESTRICTED_CHARACTERS

Class Attribute Summary collapse

Attributes inherited from AbstractAdapter

#content_type, #original_filename, #size, #tempfile

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractAdapter

#assignment?, #fingerprint, #inspect, #nil?, #read

Constructor Details

#initialize(target, options = {}) ⇒ UploadedFileAdapter

Returns a new instance of UploadedFileAdapter.



9
10
11
12
13
14
15
16
17
18
# File 'lib/paperclip/io_adapters/uploaded_file_adapter.rb', line 9

def initialize(target, options = {})
  super
  cache_current_values

  @tempfile = if @target.respond_to?(:tempfile)
                copy_to_tempfile(@target.tempfile)
              else
                copy_to_tempfile(@target)
              end
end

Class Attribute Details

.content_type_detectorObject

Returns the value of attribute content_type_detector.



21
22
23
# File 'lib/paperclip/io_adapters/uploaded_file_adapter.rb', line 21

def content_type_detector
  @content_type_detector
end

Class Method Details

.registerObject



3
4
5
6
7
# File 'lib/paperclip/io_adapters/uploaded_file_adapter.rb', line 3

def self.register
  Paperclip.io_adapters.register self do |target|
    target.class.name.include?("UploadedFile")
  end
end