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?, #browser, #eql?, #method_missing, #respond_to?, #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
|
# 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')
end
|
Instance Method Details
#localization ⇒ Object
55
56
57
58
59
60
61
62
63
|
# File 'lib/user_agent/browsers/opera.rb', line 55
def localization
if application..nil?
nil
elsif platform == "Macintosh"
application.[3]
else
application.[2]
end
end
|
#mobile? ⇒ Boolean
41
42
43
|
# File 'lib/user_agent/browsers/opera.rb', line 41
def mobile?
mini?
end
|
#os ⇒ Object
45
46
47
48
49
50
51
52
53
|
# File 'lib/user_agent/browsers/opera.rb', line 45
def os
if application..nil?
nil
elsif application.[0] =~ /Windows/
OperatingSystems.normalize_os(application.[0])
else
application.[1]
end
end
|
19
20
21
22
23
24
25
26
27
|
# File 'lib/user_agent/browsers/opera.rb', line 19
def platform
if application..nil?
nil
elsif application.[0] =~ /Windows/
"Windows"
else
application.[0]
end
end
|
#security ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/user_agent/browsers/opera.rb', line 29
def security
if application..nil?
:strong
elsif platform == "Macintosh"
Security[application.[2]]
elsif mini?
Security[application.[-2]]
else
Security[application.[1]]
end
end
|
#version ⇒ Object
9
10
11
12
13
14
15
16
17
|
# File 'lib/user_agent/browsers/opera.rb', line 9
def version
if mini?
application..detect{|c| c =~ /Opera Mini/}[/Opera Mini\/([\d\.]+)/, 1] rescue Version.new
elsif product = detect_product('Version')
product.version
else
super
end
end
|