Class: Dragonfly::Middleware

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

Instance Method Summary collapse

Constructor Details

#initialize(app, dragonfly_app_name = nil) ⇒ Middleware

Returns a new instance of Middleware.



6
7
8
9
# File 'lib/dragonfly/middleware.rb', line 6

def initialize(app, dragonfly_app_name=nil)
  @app = app
  @dragonfly_app_name = dragonfly_app_name
end

Instance Method Details

#call(env) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/dragonfly/middleware.rb', line 11

def call(env)
  response = Dragonfly.app(@dragonfly_app_name).call(env)
  if response[1]['X-Cascade'] == 'pass'
    @app.call(env)
  else
    response
  end
end