Sha256: 93f47dbca2dd7cb91fa6e81212265ae3569ac7902a06f22b0c5bbff9681d8de9
Contents?: true
Size: 1.52 KB
Versions: 2
Compression:
Stored size: 1.52 KB
Contents
class UserAgent module Browsers class Opera < Base 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.10.0 | lib/user_agent/browsers/opera.rb |
useragent-0.9.0 | lib/user_agent/browsers/opera.rb |