Class: Adrift::FileToAttach::Adapters::LocalFile
- Inherits:
-
Object
- Object
- Adrift::FileToAttach::Adapters::LocalFile
- Includes:
- Adrift::FileToAttach::Adapter
- Defined in:
- lib/adrift/file_to_attach.rb
Overview
Adapter that allow to attach a local file.
Class Method Summary collapse
-
.recognize?(file_representation) ⇒ Boolean
Indicates whether or not
file_representation
is a local file.
Instance Method Summary collapse
-
#original_filename ⇒ Object
Local file’s name.
-
#path ⇒ Object
Local file’s path.
Methods included from Adrift::FileToAttach::Adapter
Class Method Details
.recognize?(file_representation) ⇒ Boolean
Indicates whether or not file_representation
is a local file.
75 76 77 |
# File 'lib/adrift/file_to_attach.rb', line 75 def self.recognize?(file_representation) file_representation.respond_to?(:to_path) end |
Instance Method Details
#original_filename ⇒ Object
Local file’s name.
80 81 82 |
# File 'lib/adrift/file_to_attach.rb', line 80 def original_filename ::File.basename(@file_representation.to_path) end |
#path ⇒ Object
Local file’s path.
85 86 87 |
# File 'lib/adrift/file_to_attach.rb', line 85 def path @file_representation.to_path end |