Class: LemonWay::Middleware

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

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Middleware

Returns a new instance of Middleware.



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

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



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

def call(env)
  request = Rack::Request.new(env)

  ::RequestStore.store[:lemon_way] = {
    ip: request.ip,
    user_agent: request.user_agent
  }

  @app.call(env)
end