Class: SoldierOfCode::SpyVsSpy::Middleware

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

Instance Method Summary collapse

Constructor Details

#initialize(app = nil) ⇒ Middleware

Returns a new instance of Middleware.



41
42
43
# File 'lib/spy_vs_spy.rb', line 41

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

Instance Method Details

#call(env) ⇒ Object



45
46
47
48
49
50
51
52
# File 'lib/spy_vs_spy.rb', line 45

def call(env)

  http_user_agent = env['HTTP_USER_AGENT']

  env['soldierofcode.spy-vs-spy'] = SoldierOfCode::SpyVsSpy.new(http_user_agent)

  @app.call(env)
end