Class: Fash
- Inherits:
-
File
- Object
- File
- Fash
- Defined in:
- lib/rmce_uploadr/core/fash.rb
Overview
A paperclip-like UpFile class
Paperclip checks for :original_filename and :content_type so, let’s giv’em to it
the other attributes are :to_tempfile and :size but those are handled by Mash’s :method_missing
Instance Method Summary collapse
- #content_type ⇒ Object
-
#initialize(rack_multipart) ⇒ Fash
constructor
rack_multipart is what you get when a multipart-encoded form is submitted.
- #original_filename ⇒ Object
- #paperclip_content_type ⇒ Object
- #paperclip_original_filename ⇒ Object
- #to_tempfile ⇒ Object
Constructor Details
#initialize(rack_multipart) ⇒ Fash
rack_multipart is what you get when a multipart-encoded form is submitted
converts a standard rack multipart file upload to an object paperclip will understand
14 15 16 17 |
# File 'lib/rmce_uploadr/core/fash.rb', line 14 def initialize(rack_multipart) @original = rack_multipart super(rack_multipart.is_a?(String) ? rack_multipath : @original[:tempfile].path) end |
Instance Method Details
#content_type ⇒ Object
29 30 31 |
# File 'lib/rmce_uploadr/core/fash.rb', line 29 def content_type @original[:type] || paperclip_content_type end |
#original_filename ⇒ Object
24 25 26 |
# File 'lib/rmce_uploadr/core/fash.rb', line 24 def original_filename @original[:filename] || paperclip_original_filename end |
#paperclip_content_type ⇒ Object
28 |
# File 'lib/rmce_uploadr/core/fash.rb', line 28 alias :paperclip_content_type :content_type |
#paperclip_original_filename ⇒ Object
23 |
# File 'lib/rmce_uploadr/core/fash.rb', line 23 alias :paperclip_original_filename :original_filename |
#to_tempfile ⇒ Object
19 20 21 |
# File 'lib/rmce_uploadr/core/fash.rb', line 19 def to_tempfile @original[:tempfile] || @original end |