Class: SimpleWorkflow::Middleware

Inherits:
Object
  • Object
show all
Includes:
Detour
Defined in:
lib/simple_workflow/middleware.rb

Overview

Rack middleware to detect and store detours and manage returns from detours.

Instance Method Summary collapse

Methods included from Detour

#pop_detour, #reset_workflow, #store_detour_in_session

Constructor Details

#initialize(app) ⇒ Middleware

Returns a new instance of Middleware.



10
11
12
13
# File 'lib/simple_workflow/middleware.rb', line 10

def initialize(app)
  @app = app
  @simple_workflow_encryptor = nil
end

Instance Method Details

#call(env) ⇒ Object



15
16
17
18
19
20
# File 'lib/simple_workflow/middleware.rb', line 15

def call(env)
  store_detour_from_params(env)
  status, headers, response = @app.call(env)
  remove_old_detours(env)
  [status, headers, response]
end