class UserAgent::Browsers::Webkit
Constants
- BuildVersions
- WEBKIT_PRODUCT_REGEXP
- WEBKIT_VERSION_REGEXP
Public Class Methods
extend?(agent)
click to toggle source
# File lib/user_agent/browsers/webkit.rb, line 7 def self.extend?(agent) agent.detect { |useragent| useragent.product =~ WEBKIT_PRODUCT_REGEXP || useragent.detect_comment { |c| c =~ WEBKIT_VERSION_REGEXP } } end
Public Instance Methods
application()
click to toggle source
# File lib/user_agent/browsers/webkit.rb, line 71 def application self.reject { |agent| agent.comment.nil? || agent.comment.empty? }.first end
browser()
click to toggle source
# File lib/user_agent/browsers/webkit.rb, line 11 def browser if os =~ /Android/ 'Android' elsif platform == 'BlackBerry' platform else 'Safari' end end
build()
click to toggle source
# File lib/user_agent/browsers/webkit.rb, line 21 def build webkit.version end
localization()
click to toggle source
# File lib/user_agent/browsers/webkit.rb, line 117 def localization return unless application application.comment[3] end
os()
click to toggle source
# File lib/user_agent/browsers/webkit.rb, line 101 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]) elsif (os_string = application.comment.detect { |c| c =~ OperatingSystems::IOS_VERSION_REGEX }) OperatingSystems.normalize_os(os_string) else OperatingSystems.normalize_os(application.comment[2]) end end
platform()
click to toggle source
# File lib/user_agent/browsers/webkit.rb, line 75 def platform return unless application if application.comment[0] =~ /Windows/ 'Windows' elsif application.comment[0] == 'BB10' 'BlackBerry' elsif application.comment.any? { |c| c =~ /Android/ } 'Android' else application.comment[0] end end
security()
click to toggle source
# File lib/user_agent/browsers/webkit.rb, line 97 def security Security[application.comment[1]] end
version()
click to toggle source
Prior to Safari 3, the user agent did not include a version number
# File lib/user_agent/browsers/webkit.rb, line 59 def version str = if product = detect_product('Version') product.version elsif os =~ /iOS ([\d\.]+)/ && browser == "Safari" $1.tr('_', '.') else BuildVersions[build.to_s] end Version.new(str) end
webkit()
click to toggle source
# File lib/user_agent/browsers/webkit.rb, line 89 def webkit if product_match = detect { |useragent| useragent.product =~ WEBKIT_PRODUCT_REGEXP } product_match elsif comment_match = detect_comment_match(WEBKIT_VERSION_REGEXP) UserAgent.new(comment_match[:webkit], comment_match[:version]) end end