Module: Ramaze::Helper::SendFile
- Defined in:
- lib/ramaze/helper/sendfile.rb
Overview
Helper for quickly push out files with the proper mimetype.
Instance Method Summary collapse
-
#send_file(file, mime_type = Tool::MIME.type_for(file)) ⇒ Object
Sets Content-Type to the mimetype of the file and opens the file you pass it, then throws :respond to finish off the request.
Instance Method Details
#send_file(file, mime_type = Tool::MIME.type_for(file)) ⇒ Object
Sets Content-Type to the mimetype of the file and opens the file you pass it, then throws :respond to finish off the request.
12 13 14 |
# File 'lib/ramaze/helper/sendfile.rb', line 12 def send_file(file, mime_type = Tool::MIME.type_for(file)) respond File.open(file, 'rb'), 200, 'Content-Type' => mime_type end |