Class: Assette::Middleware

Inherits:
Object
  • Object
show all
Defined in:
lib/assette/middleware.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, *args) ⇒ Middleware

Returns a new instance of Middleware.



5
6
7
# File 'lib/assette/middleware.rb', line 5

def initialize(app, *args)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/assette/middleware.rb', line 9

def call(env)
  if env['PATH_INFO'] == '/'
    return @app.call(env)
  end
  
  assette_resp = Assette::Server.call(env)
  if assette_resp[0] == 200
    assette_resp
  else
    @app.call(env)
  end
end