Sha256: ef134ba1f7065793854288d26c6df01b39da899af38ed8907c5e9c81f3fc5b95

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

class UserAgent
  module Browsers
    module Opera
      def self.extend?(agent)
        agent.application && agent.application.product == "Opera"
      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]]
        else
          Security[application.comment[1]]
        end
      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
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
useragent-0.4.7 lib/user_agent/browsers/opera.rb
useragent-0.4.6 lib/user_agent/browsers/opera.rb
useragent-0.4.5 lib/user_agent/browsers/opera.rb
useragent-0.4.4 lib/user_agent/browsers/opera.rb