Class: Mobvious::Manager
- Inherits:
-
Object
- Object
- Mobvious::Manager
- Defined in:
- lib/mobvious/manager.rb
Overview
Rack middleware that enables device type detection for requests.
Use Mobvious.config
to set which strategies to use.
Look into Mobvious::Strategies
for predefined strategies or write your own.
Instance Method Summary collapse
-
#call(env) ⇒ Object
Perform the device type detection and call the inner Rack application.
-
#initialize(app) ⇒ Manager
constructor
Create a new instance of this rack middleware.
Constructor Details
#initialize(app) ⇒ Manager
Create a new instance of this rack middleware.
13 14 15 |
# File 'lib/mobvious/manager.rb', line 13 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
Perform the device type detection and call the inner Rack application.
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/mobvious/manager.rb', line 21 def call(env) request = Rack::Request.new(env) assign_device_type(request) status, headers, body = @app.call(env) response = Rack::Response.new(body, status, headers) response_callback(request, response) [status, headers, body] end |