Class: Rack::ContentDispositionHelper::UserAgent
- Inherits:
-
Object
- Object
- Rack::ContentDispositionHelper::UserAgent
- Defined in:
- lib/rack/content_disposition_helper/user_agent.rb
Constant Summary collapse
- SAFARI_PATTERN =
%r{ (:?Version|Mobile)/[0-9A-Z.]+ Safari/[0-9.]+\z}.freeze
Instance Method Summary collapse
-
#initialize(env) ⇒ UserAgent
constructor
A new instance of UserAgent.
- #safari? ⇒ Boolean
Constructor Details
#initialize(env) ⇒ UserAgent
Returns a new instance of UserAgent.
8 9 10 |
# File 'lib/rack/content_disposition_helper/user_agent.rb', line 8 def initialize(env) @user_agent = env['HTTP_USER_AGENT'] end |
Instance Method Details
#safari? ⇒ Boolean
12 13 14 |
# File 'lib/rack/content_disposition_helper/user_agent.rb', line 12 def safari? @user_agent&.match?(SAFARI_PATTERN) end |