Class: Rack::ContentDispositionHelper::UserAgent

Inherits:
Object
  • Object
show all
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

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

Returns:

  • (Boolean)


12
13
14
# File 'lib/rack/content_disposition_helper/user_agent.rb', line 12

def safari?
  @user_agent&.match?(SAFARI_PATTERN)
end