Class: Rack::UserAgent::Filter
- Inherits:
-
Object
- Object
- Rack::UserAgent::Filter
- Defined in:
- lib/rack/user_agent/filter.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, config = [], options = {}) ⇒ Filter
constructor
A new instance of Filter.
Constructor Details
#initialize(app, config = [], options = {}) ⇒ Filter
Returns a new instance of Filter.
8 9 10 11 12 |
# File 'lib/rack/user_agent/filter.rb', line 8 def initialize(app, config = [], = {}) @app = app @browsers = config @template = [:template] end |
Instance Method Details
#call(env) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/rack/user_agent/filter.rb', line 14 def call(env) browser = UserAgent.parse(env["HTTP_USER_AGENT"]) if env["HTTP_USER_AGENT"] if unsupported?(browser) [400, {"Content-Type" => "text/html"}, page(env['rack.locale'], browser)] else @app.call(env) end end |