Class: Adrift::FileToAttach::Adapters::LocalFile

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Methods included from Adrift::FileToAttach::Adapter

#initialize

Class Method Details

.recognize?(file_representation) ⇒ Boolean

Indicates whether or not file_representation is a local file.

Returns:

  • (Boolean)


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_filenameObject

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

#pathObject

Local file’s path.



85
86
87
# File 'lib/adrift/file_to_attach.rb', line 85

def path
  @file_representation.to_path
end