module Mojito::Rendering::File

Public Instance Methods

file!(filename) click to toggle source
# File lib/mojito/rendering/file.rb, line 11
def file!(filename)
        path = Where.cdir(1) + filename
        restrict_path! path if respond_to? :restrict_path!
        if path.readable? and path.file?
                body = FileResponse.new path
                halt! [response.status, response.headers.merge(body.compute_headers), body]
        else
                not_found!
        end
end