Sha256: 4c76d33516faf960e766bfc2c352a40aff1ea353feba910120c27de22adf976f

Contents?: true

Size: 497 Bytes

Versions: 8

Compression:

Stored size: 497 Bytes

Contents

module Saviour
  class SourceFilenameExtractor
    def initialize(source)
      @source = source
    end

    def detected_filename
      original_filename || path_filename
    end

    def original_filename
      value = @source.original_filename if @source.respond_to?(:original_filename)
      value if !value.nil? && value != ''
    end

    def path_filename
      value = @source.path if @source.respond_to?(:path)
      ::File.basename(value) if !value.nil? && value != ''
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
saviour-0.4.5 lib/saviour/source_filename_extractor.rb
saviour-0.4.4 lib/saviour/source_filename_extractor.rb
saviour-0.4.3 lib/saviour/source_filename_extractor.rb
saviour-0.4.2 lib/saviour/source_filename_extractor.rb
saviour-0.4.1 lib/saviour/source_filename_extractor.rb
saviour-0.4.0 lib/saviour/source_filename_extractor.rb
saviour-0.3.1 lib/saviour/source_filename_extractor.rb
saviour-0.3.0 lib/saviour/source_filename_extractor.rb