module Shrine::Plugins::RackFile::ClassMethods

  1. lib/shrine/plugins/rack_file.rb

Methods

Public Instance

  1. rack_file

Public Instance methods

rack_file(hash)

Accepts a Rack uploaded file hash and wraps it in an IO object.

[show source]
   # File lib/shrine/plugins/rack_file.rb
11 def rack_file(hash)
12   if hash[:filename]
13     # Rack can sometimes return the filename binary encoded, so we force
14     # the encoding to utf-8
15     hash = hash.merge(
16       filename: hash[:filename].dup.force_encoding(Encoding::UTF_8)
17     )
18   end
19 
20   Shrine::RackFile.new(hash)
21 end