Class: Paperclip::AttachmentAdapter

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

Instance Method Summary collapse

Constructor Details

#initialize(target) ⇒ AttachmentAdapter

Returns a new instance of AttachmentAdapter.



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

def initialize(target)
  @target = target
  cache_current_values
end

Instance Method Details

#content_typeObject



12
13
14
# File 'lib/paperclip/io_adapters/attachment_adapter.rb', line 12

def content_type
  @content_type
end

#eof?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/paperclip/io_adapters/attachment_adapter.rb', line 37

def eof?
  @tempfile.eof?
end

#fingerprintObject



24
25
26
# File 'lib/paperclip/io_adapters/attachment_adapter.rb', line 24

def fingerprint
  @fingerprint ||= Digest::MD5.file(path).to_s
end

#nil?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/paperclip/io_adapters/attachment_adapter.rb', line 20

def nil?
  false
end

#original_filenameObject



8
9
10
# File 'lib/paperclip/io_adapters/attachment_adapter.rb', line 8

def original_filename
  @original_filename
end

#pathObject



41
42
43
# File 'lib/paperclip/io_adapters/attachment_adapter.rb', line 41

def path
  @tempfile.path
end

#read(length = nil, buffer = nil) ⇒ Object



28
29
30
# File 'lib/paperclip/io_adapters/attachment_adapter.rb', line 28

def read(length = nil, buffer = nil)
  @tempfile.read(length, buffer)
end

#rewindObject

We don’t use this directly, but aws/sdk does.



33
34
35
# File 'lib/paperclip/io_adapters/attachment_adapter.rb', line 33

def rewind
  @tempfile.rewind
end

#sizeObject



16
17
18
# File 'lib/paperclip/io_adapters/attachment_adapter.rb', line 16

def size
  @size
end