Class: Rack::UserAgent

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/user_agent.rb,
lib/rack/user_agent/result.rb,
lib/rack/user_agent/checker.rb,
lib/rack/user_agent/railtie.rb,
lib/rack/user_agent/version.rb,
lib/rack/user_agent/detector.rb

Defined Under Namespace

Modules: Checker, Detector, Result Classes: Railtie

Constant Summary collapse

VERSION =
"0.5.3"

Instance Method Summary collapse

Constructor Details

#initialize(app, options = {}) ⇒ UserAgent

Returns a new instance of UserAgent.



10
11
12
# File 'lib/rack/user_agent.rb', line 10

def initialize(app, options = {})
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



14
15
16
17
# File 'lib/rack/user_agent.rb', line 14

def call(env)
  env["rack.woothee"] = ::Woothee.parse(env["HTTP_USER_AGENT"] || "")
  @app.call(env)
end