Sha256: 7afb69beb825eae0af7257ed628e0a6de2086da8871ba0b324540f78289169da

Contents?: true

Size: 1.27 KB

Versions: 8

Compression:

Stored size: 1.27 KB

Contents

class UserAgent
  module Browsers
    # CoreMedia is a framework on iOS and is used by various iOS apps to playback media.
    class AppleCoreMedia < Base
      def self.extend?(agent)
        agent.detect { |useragent| useragent.product == 'AppleCoreMedia' }
      end

      def browser
        "AppleCoreMedia"
      end

      def application
        self.reject { |agent| agent.comment.nil? || agent.comment.empty? }.first
      end

      def platform
        return unless application

        if application.comment[0] =~ /Windows/
          'Windows'
        else
          application.comment[0]
        end
      end

      def security
        Security[application.comment[1]]
      end

      def os
        return unless application

        if application.comment[0] =~ /Windows NT/
          OperatingSystems.normalize_os(application.comment[0])
        elsif application.comment[2].nil?
          OperatingSystems.normalize_os(application.comment[1])
        elsif application.comment[1] =~ /Android/
          OperatingSystems.normalize_os(application.comment[1])
        else
          OperatingSystems.normalize_os(application.comment[2])
        end
      end

      def localization
        return unless application

        application.comment[3]
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
useragent-0.16.11 lib/user_agent/browsers/apple_core_media.rb
useragent-0.16.10 lib/user_agent/browsers/apple_core_media.rb
useragent-0.16.9 lib/user_agent/browsers/apple_core_media.rb
useragent-0.16.8 lib/user_agent/browsers/apple_core_media.rb
useragent-0.16.7 lib/user_agent/browsers/apple_core_media.rb
useragent-0.16.6 lib/user_agent/browsers/apple_core_media.rb
useragent-0.16.5 lib/user_agent/browsers/apple_core_media.rb
useragent-0.16.4 lib/user_agent/browsers/apple_core_media.rb