Class: Paperclip::AttachmentAdapter

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

Constant Summary

Constants inherited from AbstractAdapter

Paperclip::AbstractAdapter::OS_RESTRICTED_CHARACTERS

Instance Attribute Summary

Attributes inherited from AbstractAdapter

#content_type, #original_filename, #size

Instance Method Summary collapse

Methods inherited from AbstractAdapter

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

Constructor Details

#initialize(target) ⇒ AttachmentAdapter

Returns a new instance of AttachmentAdapter.



3
4
5
6
7
8
9
10
11
12
# File 'lib/paperclip/io_adapters/attachment_adapter.rb', line 3

def initialize(target)
  @target, @style = case target
  when Paperclip::Attachment
    [target, :original]
  when Paperclip::Style
    [target.attachment, target.name]
  end

  cache_current_values
end