Sha256: eb00f7beebea639d9d908e9dba17c7a241e1927f6ce655b10812b3c8b6e5688e
Contents?: true
Size: 1.52 KB
Versions: 2
Compression:
Stored size: 1.52 KB
Contents
class UserAgent module Browsers module Opera def self.extend?(agent) (agent.first && agent.first.product == 'Opera') || (agent.application && agent.application.product == 'Opera') end def version if mini? application.comment[1][/Opera Mini\/([\d\.]+)/, 1] elsif product = detect_product('Version') product.version else super end end def platform if application.comment.nil? nil elsif application.comment[0] =~ /Windows/ "Windows" else application.comment[0] end end def security if application.comment.nil? :strong elsif platform == "Macintosh" Security[application.comment[2]] elsif mini? Security[application.comment[-2]] else Security[application.comment[1]] end end def mobile? mini? end def os if application.comment.nil? nil elsif application.comment[0] =~ /Windows/ OperatingSystems.normalize_os(application.comment[0]) else application.comment[1] end end def localization if application.comment.nil? nil elsif platform == "Macintosh" application.comment[3] else application.comment[2] end end private def mini? /Opera Mini/ === application end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
useragent-0.8.3 | lib/user_agent/browsers/opera.rb |
useragent-0.8.2 | lib/user_agent/browsers/opera.rb |