Sha256: 9daa8ab8bf8fd2ba956d7ad1c5e018ab5d380115a4bd8f66a77e1149ebe259be

Contents?: true

Size: 427 Bytes

Versions: 7

Compression:

Stored size: 427 Bytes

Contents

module Locomotive::Coal

  class UploadIO < ::Faraday::UploadIO

    def initialize(filename_or_io, content_type = nil, filename = nil)
      if filename.blank? && filename_or_io.is_a?(String)
        filename = File.basename(filename_or_io)
      end

      super(
        filename_or_io,
        content_type || MIME::Types.type_for(filename).first || 'application/octet-stream',
        filename
      )
    end

  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
locomotivecms_coal-1.8.0.alpha1 lib/locomotive/coal/upload_io.rb
locomotivecms_coal-1.7.0 lib/locomotive/coal/upload_io.rb
locomotivecms_coal-1.6.0 lib/locomotive/coal/upload_io.rb
locomotivecms_coal-1.6.0.rc2 lib/locomotive/coal/upload_io.rb
locomotivecms_coal-1.6.0.rc1 lib/locomotive/coal/upload_io.rb
locomotivecms_coal-1.6.0.beta1 lib/locomotive/coal/upload_io.rb
locomotivecms_coal-1.5.1 lib/locomotive/coal/upload_io.rb