class UserAgent::Browsers::Chrome
Constants
- ChromeBrowsers
Public Class Methods
Source
# File lib/user_agent/browsers/chrome.rb, line 4 def self.extend?(agent) agent.detect { |useragent| %w(Chrome CriOS).include?(useragent.product) } end
Public Instance Methods
Source
# File lib/user_agent/browsers/chrome.rb, line 33 def application self.reject { |agent| agent.comment.nil? || agent.comment.empty? }.first end
Source
# File lib/user_agent/browsers/chrome.rb, line 14 def browser ChromeBrowsers.detect { |browser| respond_to?(browser) } || 'Chrome' end
Source
# File lib/user_agent/browsers/chrome.rb, line 69 def localization return unless application application.comment[3] end
Source
# File lib/user_agent/browsers/chrome.rb, line 55 def os return unless application if application.comment[0] =~ /Windows NT/ OperatingSystems.normalize_os(application.comment[0]) elsif application.comment[2].nil? OperatingSystems.normalize_os(application.comment[1]) elsif application.comment[1] =~ /Android/ OperatingSystems.normalize_os(application.comment[1]) else OperatingSystems.normalize_os(application.comment[2]) end end
Source
# File lib/user_agent/browsers/chrome.rb, line 37 def platform return unless application if application.comment[0] =~ /Windows/ 'Windows' elsif application.comment.any? { |c| c =~ /CrOS/ } 'ChromeOS' elsif application.comment.any? { |c| c =~ /Android/ } 'Android' else application.comment[0] end end
Source
# File lib/user_agent/browsers/chrome.rb, line 23 def version str = if detect_product("CriOs") crios.version else chrome.version end Version.new(str) end
Prior to Safari 3, the user agent did not include a version number
Source
# File lib/user_agent/browsers/chrome.rb, line 51 def webkit detect { |useragent| useragent.product == "AppleWebKit" } end