Class: Locomotive::Coal::UploadIO

Inherits:
Faraday::UploadIO
  • Object
show all
Defined in:
lib/locomotive/coal/upload_io.rb

Instance Method Summary collapse

Constructor Details

#initialize(filename_or_io, content_type = nil, filename = nil) ⇒ UploadIO

Returns a new instance of UploadIO.



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/locomotive/coal/upload_io.rb', line 5

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