Class: RailsSameSiteCookie::UserAgentChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_same_site_cookie/user_agent_checker.rb

Constant Summary collapse

PARSER =
UserAgentParser::Parser.new

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user_agent = nil) ⇒ UserAgentChecker

Returns a new instance of UserAgentChecker.



14
15
16
17
# File 'lib/rails_same_site_cookie/user_agent_checker.rb', line 14

def initialize(user_agent=nil)
  @user_agent_str = user_agent
  @user_agent = PARSER.parse(user_agent) if user_agent
end

Instance Attribute Details

#user_agentObject

Returns the value of attribute user_agent.



7
8
9
# File 'lib/rails_same_site_cookie/user_agent_checker.rb', line 7

def user_agent
  @user_agent
end

Instance Method Details

#chrome?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/rails_same_site_cookie/user_agent_checker.rb', line 24

def chrome?
  is_chromium_based?
end

#send_same_site_none?Boolean

Returns:

  • (Boolean)


19
20
21
22
# File 'lib/rails_same_site_cookie/user_agent_checker.rb', line 19

def send_same_site_none?
  return true if user_agent.nil? or @user_agent_str == ''
  return !missing_same_site_none_support?
end