class Mojito::Rendering::File::FileResponse
Public Class Methods
new(pathname)
click to toggle source
# File lib/mojito/rendering/file.rb, line 24 def initialize(pathname) @pathname = pathname end
Public Instance Methods
compute_headers()
click to toggle source
# File lib/mojito/rendering/file.rb, line 34 def compute_headers { 'Content-Type' => mime_type.to_s, 'Content-Length' => size.to_s, 'Last-Modified' => @pathname.mtime.rfc2822 } end
each() { |read| ... }
click to toggle source
# File lib/mojito/rendering/file.rb, line 28 def each(&block) @pathname.open do |f| yield f.read end end
mime_type()
click to toggle source
# File lib/mojito/rendering/file.rb, line 38 def mime_type MIME::Types.type_for(@pathname.to_s).first || MIME::Types['application/octet-stream'].first end
size()
click to toggle source
# File lib/mojito/rendering/file.rb, line 42 def size @pathname.size end
to_path()
click to toggle source
# File lib/mojito/rendering/file.rb, line 46 def to_path @pathname.to_s end