Module: Aua::OperatingSystems::Mobiles

Defined in:
lib/aua/operating_systems/mobiles.rb

Constant Summary collapse

PATTERN_SYMBIAN =
/Symb(ian)?\s?OS\/?([\d\.]+)?/

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extend?(agent) ⇒ Boolean

Returns:

  • (Boolean)


2
3
4
5
6
# File 'lib/aua/operating_systems/mobiles.rb', line 2

def self.extend?(agent)
  agent.platform_string == "BlackBerry" ||
  agent.platform_string == "J2ME/MIDP" ||
  agent.app_comments_string =~ PATTERN_SYMBIAN
end

Instance Method Details

#nameObject



10
11
12
13
14
15
16
# File 'lib/aua/operating_systems/mobiles.rb', line 10

def name
  @name ||= begin
    name = super
    return :OperaMobile if name == :Opera && platform == :SymbianOS
    name
  end
end

#os_nameObject



25
26
27
# File 'lib/aua/operating_systems/mobiles.rb', line 25

def os_name
  @os_name ||= platform
end

#os_versionObject



29
30
31
32
33
34
# File 'lib/aua/operating_systems/mobiles.rb', line 29

def os_version
  @os_version ||= begin
    return $2 if app_comments_string =~ PATTERN_SYMBIAN
    nil
  end
end

#platformObject



18
19
20
21
22
23
# File 'lib/aua/operating_systems/mobiles.rb', line 18

def platform
  @platform ||= begin
    return :SymbianOS if app_comments_string =~ PATTERN_SYMBIAN
    platform_string.to_sym
  end
end