Class: UserAgent::Browsers::Webkit
- Inherits:
-
Base
- Object
- Array
- Base
- UserAgent::Browsers::Webkit
show all
- Defined in:
- lib/user_agent/browsers/webkit.rb
Direct Known Subclasses
ITunes
Constant Summary
collapse
- WEBKIT_PRODUCT_REGEXP =
/\AAppleWebKit\z/i
- WEBKIT_VERSION_REGEXP =
/\A(?<webkit>AppleWebKit)\/(?<version>[\d\.]+)/i
- BuildVersions =
{
"85.7" => "1.0",
"85.8.5" => "1.0.3",
"85.8.2" => "1.0.3",
"124" => "1.2",
"125.2" => "1.2.2",
"125.4" => "1.2.3",
"125.5.5" => "1.2.4",
"125.5.6" => "1.2.4",
"125.5.7" => "1.2.4",
"312.1.1" => "1.3",
"312.1" => "1.3",
"312.5" => "1.3.1",
"312.5.1" => "1.3.1",
"312.5.2" => "1.3.1",
"312.8" => "1.3.2",
"312.8.1" => "1.3.2",
"412" => "2.0",
"412.6" => "2.0",
"412.6.2" => "2.0",
"412.7" => "2.0.1",
"416.11" => "2.0.2",
"416.12" => "2.0.2",
"417.9" => "2.0.3",
"418" => "2.0.3",
"418.8" => "2.0.4",
"418.9" => "2.0.4",
"418.9.1" => "2.0.4",
"419" => "2.0.4",
"425.13" => "2.2",
"534.52.7" => "5.1.2"
}.freeze
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#<=>, #bot?, #eql?, #method_missing, #mobile?, #respond_to?, #to_h, #to_s, #to_str
Methods included from Comparable
#<, #<=, #==, #>, #>=
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class UserAgent::Browsers::Base
Class Method Details
.extend?(agent) ⇒ Boolean
Instance Method Details
#application ⇒ Object
71
72
73
|
# File 'lib/user_agent/browsers/webkit.rb', line 71
def application
self.reject { |agent| agent..nil? || agent..empty? }.first
end
|
#browser ⇒ Object
11
12
13
14
15
16
17
18
19
|
# File 'lib/user_agent/browsers/webkit.rb', line 11
def browser
if os =~ /Android/
'Android'
elsif platform == 'BlackBerry'
platform
else
'Safari'
end
end
|
#build ⇒ Object
21
22
23
|
# File 'lib/user_agent/browsers/webkit.rb', line 21
def build
webkit.version
end
|
#localization ⇒ Object
117
118
119
120
121
|
# File 'lib/user_agent/browsers/webkit.rb', line 117
def localization
return unless application
application.[3]
end
|
75
76
77
78
79
80
81
82
83
84
85
86
87
|
# File 'lib/user_agent/browsers/webkit.rb', line 75
def platform
return unless application
if application.[0] =~ /Windows/
'Windows'
elsif application.[0] == 'BB10'
'BlackBerry'
elsif application..any? { |c| c =~ /Android/ }
'Android'
else
application.[0]
end
end
|
#security ⇒ Object
97
98
99
|
# File 'lib/user_agent/browsers/webkit.rb', line 97
def security
Security[application.[1]]
end
|
#version ⇒ Object
Prior to Safari 3, the user agent did not include a version number
59
60
61
62
63
64
65
66
67
68
69
|
# 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
|