Module: Shrine::Plugins::RackFile::ClassMethods
- Defined in:
- lib/shrine/plugins/rack_file.rb
Instance Method Summary collapse
-
#rack_file(hash) ⇒ Object
Accepts a Rack uploaded file hash and wraps it in an IO object.
Instance Method Details
#rack_file(hash) ⇒ Object
Accepts a Rack uploaded file hash and wraps it in an IO object.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/shrine/plugins/rack_file.rb', line 13 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 |