Permalink
Browse files

lets give this middleware another shot.

  • Loading branch information...
1 parent b40f9ac commit 72cf2ac5beb3158d580f73fe49e84e042f099409 @ajsharp ajsharp committed Jun 11, 2011
Showing with 22 additions and 21 deletions.
  1. +22 −21 lib/aarrr/middleware.rb
View
@@ -1,22 +1,23 @@
# DONT USE THIS, ITS FUCKED
-# module AARRR
-# class Middleware
-#
-# def initialize(app)
-# @app = app
-# end
-#
-# def call(env)
-# aarrr_session = AARRR(env)
-#
-# status, headers, body = @app.call(env)
-# # require 'ruby-debug';debugger
-# # sets a tracking cookie on the response
-# response = Rack::Response.new body, status, headers
-# # aarrr_session.set_cookie(response)
-#
-# response.finish
-# end
-#
-# end
-# end
+
+module AARRR
+ class Middleware
+
+ def initialize(app)
+ @app = app
+ end
+
+ def call(env)
+ aarrr_session = AARRR(env)
+
+ status, headers, body = @app.call(env)
+ # require 'ruby-debug';debugger
+ # sets a tracking cookie on the response
+ response = Rack::Response.new body, status, headers
+ aarrr_session.set_cookie(response)
+
+ response.finish
+ end
+
+ end
+end

0 comments on commit 72cf2ac

Please sign in to comment.