Class: UserAgent::Browsers::Opera
- Inherits:
-
Base
- Object
- Array
- Base
- UserAgent::Browsers::Opera
show all
- Defined in:
- lib/user_agent/browsers/opera.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#<=>, #application, #bot?, #eql?, #method_missing, #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
4
5
6
7
8
|
# File 'lib/user_agent/browsers/opera.rb', line 4
def self.extend?(agent)
(agent.first && agent.first.product == 'Opera') ||
(agent.application && agent.application.product == 'Opera') ||
(agent.last && agent.last.product == 'OPR')
end
|
Instance Method Details
#browser ⇒ Object
10
11
12
|
# File 'lib/user_agent/browsers/opera.rb', line 10
def browser
'Opera'
end
|
#localization ⇒ Object
62
63
64
65
66
67
68
69
70
|
# File 'lib/user_agent/browsers/opera.rb', line 62
def localization
return unless application.
if macintosh?
application.[3]
else
application.[2]
end
end
|
#mobile? ⇒ Boolean
48
49
50
|
# File 'lib/user_agent/browsers/opera.rb', line 48
def mobile?
mini?
end
|
#os ⇒ Object
52
53
54
55
56
57
58
59
60
|
# File 'lib/user_agent/browsers/opera.rb', line 52
def os
return unless application.
if application.[0] =~ /Windows/
OperatingSystems.normalize_os(application.[0])
else
application.[1]
end
end
|
26
27
28
29
30
31
32
33
34
|
# File 'lib/user_agent/browsers/opera.rb', line 26
def platform
return unless application.
if application.[0] =~ /Windows/
"Windows"
else
application.[0]
end
end
|
#security ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/user_agent/browsers/opera.rb', line 36
def security
if application..nil?
:strong
elsif macintosh?
Security[application.[2]]
elsif mini?
Security[application.[-2]]
else
Security[application.[1]]
end
end
|
#version ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/user_agent/browsers/opera.rb', line 14
def version
if mini?
Version.new(application..detect{|c| c =~ /Opera Mini/}[/Opera Mini\/([\d\.]+)/, 1]) rescue Version.new
elsif product = detect_product('Version')
Version.new(product.version)
elsif product = detect_product('OPR')
Version.new(product.version)
else
super
end
end
|