Class: UserAgent::Browsers::AppleCoreMedia

Inherits:
Base
  • Object
show all
Defined in:
lib/user_agent/browsers/apple_core_media.rb

Overview

CoreMedia is a framework on iOS and is used by various iOS apps to playback media.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#<=>, #bot?, #eql?, #method_missing, #mobile?, #respond_to?, #to_h, #to_s, #to_str, #version

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

Returns:

  • (Boolean)


5
6
7
# File 'lib/user_agent/browsers/apple_core_media.rb', line 5

def self.extend?(agent)
  agent.detect { |useragent| useragent.product == 'AppleCoreMedia' }
end

Instance Method Details

#applicationObject



13
14
15
# File 'lib/user_agent/browsers/apple_core_media.rb', line 13

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

#browserObject



9
10
11
# File 'lib/user_agent/browsers/apple_core_media.rb', line 9

def browser
  "AppleCoreMedia"
end

#localizationObject



45
46
47
48
49
# File 'lib/user_agent/browsers/apple_core_media.rb', line 45

def localization
  return unless application

  application.comment[3]
end

#osObject



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/user_agent/browsers/apple_core_media.rb', line 31

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

#platformObject



17
18
19
20
21
22
23
24
25
# File 'lib/user_agent/browsers/apple_core_media.rb', line 17

def platform
  return unless application

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

#securityObject



27
28
29
# File 'lib/user_agent/browsers/apple_core_media.rb', line 27

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