Class: Adrift::FileToAttach::Adapters::Rails
- Inherits:
-
Object
- Object
- Adrift::FileToAttach::Adapters::Rails
- Includes:
- Adrift::FileToAttach::Adapter
- Defined in:
- lib/adrift/file_to_attach.rb
Overview
Adapter that allows to attach an uploaded file within a Rails application.
Class Method Summary collapse
-
.recognize?(file_representation) ⇒ Boolean
Indicates whether or not
file_representation
is an uploaded file within a Rails application.
Instance Method Summary collapse
-
#original_filename ⇒ Object
Uploaded file’s original filename.
-
#path ⇒ Object
Uploaded file’s path.
Methods included from Adrift::FileToAttach::Adapter
Class Method Details
.recognize?(file_representation) ⇒ Boolean
Indicates whether or not file_representation
is an uploaded file within a Rails application.
53 54 55 56 |
# File 'lib/adrift/file_to_attach.rb', line 53 def self.recognize?(file_representation) file_representation.respond_to?(:original_filename) && file_representation.respond_to?(:tempfile) end |
Instance Method Details
#original_filename ⇒ Object
Uploaded file’s original filename.
59 60 61 |
# File 'lib/adrift/file_to_attach.rb', line 59 def original_filename @file_representation.original_filename end |
#path ⇒ Object
Uploaded file’s path.
64 65 66 |
# File 'lib/adrift/file_to_attach.rb', line 64 def path @file_representation.tempfile.path end |