Sha256: 617d7f587b66f1cad897fd26d3c3d9e1e3a28b558c62a5014c2d1dd54ab6f609
Contents?: true
Size: 932 Bytes
Versions: 14
Compression:
Stored size: 932 Bytes
Contents
module Ahoy module Deckhands class TechnologyDeckhand def initialize(user_agent) @user_agent = user_agent end def browser agent.name end def os agent.os.name end def device_type @device_type ||= begin browser = Browser.new(@user_agent) if browser.bot? "Bot" elsif browser.device.tv? "TV" elsif browser.device.console? "Console" elsif browser.device.tablet? "Tablet" elsif browser.device.mobile? "Mobile" else "Desktop" end end end protected def agent @agent ||= self.class.user_agent_parser.parse(@user_agent) end # performance def self.user_agent_parser @user_agent_parser ||= UserAgentParser::Parser.new end end end end
Version data entries
14 entries across 14 versions & 1 rubygems