Class: Jabs::Rack::File

Inherits:
Rack::File
  • Object
show all
Defined in:
lib/jabs/middleware.rb

Instance Method Summary collapse

Instance Method Details

#servingObject



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/jabs/middleware.rb', line 28

def serving
  status, headers, body = * super
  return [status, headers, body] unless status == 200
  
  jabs = Jabs::Engine.new(open(body.path).read).render
  
  headers['Content-Type'] = 'text/javascript'
  headers['Content-Length'] = jabs.size.to_s
  
  [status, headers, jabs]
end