Class: Paperclip::AttachmentAdapter
- Inherits:
-
Object
- Object
- Paperclip::AttachmentAdapter
- Defined in:
- lib/paperclip/io_adapters/attachment_adapter.rb
Instance Method Summary collapse
- #content_type ⇒ Object
- #eof? ⇒ Boolean
- #fingerprint ⇒ Object
-
#initialize(target) ⇒ AttachmentAdapter
constructor
A new instance of AttachmentAdapter.
- #nil? ⇒ Boolean
- #original_filename ⇒ Object
- #path ⇒ Object
- #read(length = nil, buffer = nil) ⇒ Object
-
#rewind ⇒ Object
We don’t use this directly, but aws/sdk does.
- #size ⇒ Object
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_type ⇒ Object
12 13 14 |
# File 'lib/paperclip/io_adapters/attachment_adapter.rb', line 12 def content_type @content_type end |
#eof? ⇒ Boolean
37 38 39 |
# File 'lib/paperclip/io_adapters/attachment_adapter.rb', line 37 def eof? @tempfile.eof? end |
#fingerprint ⇒ Object
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
20 21 22 |
# File 'lib/paperclip/io_adapters/attachment_adapter.rb', line 20 def nil? false end |
#original_filename ⇒ Object
8 9 10 |
# File 'lib/paperclip/io_adapters/attachment_adapter.rb', line 8 def original_filename @original_filename end |
#path ⇒ Object
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 |
#rewind ⇒ Object
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 |
#size ⇒ Object
16 17 18 |
# File 'lib/paperclip/io_adapters/attachment_adapter.rb', line 16 def size @size end |