13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/jasmine-sprockets/jasmine_file.rb', line 13
def serving
unless @@cache[@path] && @@cache[@path][0] >= F.mtime(@path)
@@cache[@path] = [F.mtime(@path), sprocket[@path]]
end
base = @@cache[@path][1]
ctype = base.content_type
body = [base.to_s]
size = Utils.bytesize(body.first)
[200, {
"Last-Modified" => F.mtime(@path).httpdate,
"Cache-Control" => "must-revalidate",
"Content-Type" => ctype || Mime.mime_type(F.extname(@path), 'text/plain'),
"Content-Length" => size.to_s
}, body]
end
|