module Shrine::Plugins::RackFile::ClassMethods
Public Instance Methods
rack_file(hash)
click to toggle source
Accepts a Rack uploaded file hash and wraps it in an IO object.
# File lib/shrine/plugins/rack_file.rb, line 11 def rack_file(hash) if hash[:filename] # Rack can sometimes return the filename binary encoded, so we force # the encoding to utf-8 hash = hash.merge( filename: hash[:filename].dup.force_encoding(Encoding::UTF_8) ) end Shrine::RackFile.new(hash) end