module SimpleImagesDownloader::StringioToTempfile

Public Instance Methods

convert(stringio) click to toggle source
# File lib/simple_images_downloader/stringio_to_tempfile.rb, line 7
def convert(stringio)
  tempfile = Tempfile.new(binmode: true)

  IO.copy_stream(stringio, tempfile)

  stringio.close

  OpenURI::Meta.init tempfile, stringio

  tempfile
end