Sha256: 4ce2260660a92c64c6c6baea023932a30ae62a40c31b562d155656ba5ce5e67c

Contents?: true

Size: 642 Bytes

Versions: 18

Compression:

Stored size: 642 Bytes

Contents

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

    def detected_filename
      original_filename || filename || path_filename
    end

    def filename
      value = @source.filename if @source.respond_to?(:filename)
      value if !value.nil? && value != ''
    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

18 entries across 18 versions & 1 rubygems

Version Path
saviour-0.6.10 lib/saviour/source_filename_extractor.rb
saviour-0.6.9 lib/saviour/source_filename_extractor.rb
saviour-0.6.8 lib/saviour/source_filename_extractor.rb
saviour-0.6.7 lib/saviour/source_filename_extractor.rb
saviour-0.6.6 lib/saviour/source_filename_extractor.rb
saviour-0.6.5 lib/saviour/source_filename_extractor.rb
saviour-0.6.4 lib/saviour/source_filename_extractor.rb
saviour-0.6.3 lib/saviour/source_filename_extractor.rb
saviour-0.6.2 lib/saviour/source_filename_extractor.rb
saviour-0.6.1 lib/saviour/source_filename_extractor.rb
saviour-0.6.0 lib/saviour/source_filename_extractor.rb
saviour-0.5.11 lib/saviour/source_filename_extractor.rb
saviour-0.5.10 lib/saviour/source_filename_extractor.rb
saviour-0.5.9 lib/saviour/source_filename_extractor.rb
saviour-0.5.8 lib/saviour/source_filename_extractor.rb
saviour-0.5.7 lib/saviour/source_filename_extractor.rb
saviour-0.5.6 lib/saviour/source_filename_extractor.rb
saviour-0.5.5 lib/saviour/source_filename_extractor.rb