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.



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

def initialize(target)
  @target = target
  cache_current_values
end

Instance Method Details

#content_typeObject



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

def content_type
  @content_type
end

#eof?Boolean

Returns:

  • (Boolean)


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

def eof?
  @tempfile.eof?
end

#fingerprintObject



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

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

#nil?Boolean

Returns:

  • (Boolean)


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

def nil?
  false
end

#original_filenameObject



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

def original_filename
  @original_filename
end

#pathObject



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

def path
  @tempfile.path
end

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



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

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

#sizeObject



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

def size
  @size
end