Class: Saviour::SourceFilenameExtractor
- Inherits:
-
Object
- Object
- Saviour::SourceFilenameExtractor
- Defined in:
- lib/saviour/source_filename_extractor.rb
Instance Method Summary collapse
- #detected_filename ⇒ Object
-
#initialize(source) ⇒ SourceFilenameExtractor
constructor
A new instance of SourceFilenameExtractor.
- #original_filename ⇒ Object
- #path_filename ⇒ Object
Constructor Details
#initialize(source) ⇒ SourceFilenameExtractor
Returns a new instance of SourceFilenameExtractor.
3 4 5 |
# File 'lib/saviour/source_filename_extractor.rb', line 3 def initialize(source) @source = source end |
Instance Method Details
#detected_filename ⇒ Object
7 8 9 |
# File 'lib/saviour/source_filename_extractor.rb', line 7 def detected_filename original_filename || path_filename end |
#original_filename ⇒ Object
11 12 13 14 |
# File 'lib/saviour/source_filename_extractor.rb', line 11 def original_filename value = @source.original_filename if @source.respond_to?(:original_filename) value if !value.nil? && value != '' end |
#path_filename ⇒ Object
16 17 18 19 |
# File 'lib/saviour/source_filename_extractor.rb', line 16 def path_filename value = @source.path if @source.respond_to?(:path) ::File.basename(value) if !value.nil? && value != '' end |