Sha256: 7f11051f88b296f21ad95d5200fd7ff6f492fe2757313178b32ea5b0d0415679

Contents?: true

Size: 593 Bytes

Versions: 4

Compression:

Stored size: 593 Bytes

Contents

#          Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
# All files in this distribution are subject to the terms of the Ruby license.

module Ramaze

  # Helper for quickly push out files with the proper mimetype.

  module FileHelper
    private

    # Sets Content-Type to the mimetype of the file and opens the file you pass
    # it, then throws :respond to finish off the request.

    def send_file(file, mime_type = Tool::MIME.type_for(file))
      response.header["Content-Type"] = mime_type
      response.body = File.open(file)
      throw(:respond)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ramaze-0.1.3 lib/ramaze/helper/file.rb
ramaze-0.1.4 lib/ramaze/helper/file.rb
ramaze-0.2.1 lib/ramaze/helper/file.rb
ramaze-0.2.0 lib/ramaze/helper/file.rb