Module: Aua::Agents::Safari

Defined in:
lib/aua/agents/safari.rb

Constant Summary collapse

BUILDS =
{
  '85' => '1.0',
  '85.5'=>'1.0',
  '85.7'=>'1.0.2',
  '85.8'=>'1.0.3',
  '85.8.1'=>'1.0.3',
  '100'=>'1.1',
  '100.1'=>'1.1.1',
  '125.7'=>'1.2.2',
  '125.8'=>'1.2.2',
  '125.9'=>'1.2.3',
  '125.11'=>'1.2.4',
  '125.12'=>'1.2.4',
  '312'=>'1.3',
  '312.3'=>'1.3.1',
  '312.3.1'=>'1.3.1',
  '312.5'=>'1.3.2',
  '312.6'=>'1.3.2',
  '412'=>'2.0',
  '412.2'=>'2.0',
  '412.2.2'=>'2.0',
  '412.5'=>'2.0.1',
  '416.12'=>'2.0.2',
  '416.13'=>'2.0.2',
  '417.8'=>'2.0.3',
  '417.9.2'=>'2.0.3',
  '417.9.3'=>'2.0.3',
  '419.3'=>'2.0.4',
  '419' => '2.0.4',
  '425.13' => '2.2'
}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extend?(agent) ⇒ Boolean

Returns:

  • (Boolean)


2
3
4
5
6
7
8
# File 'lib/aua/agents/safari.rb', line 2

def self.extend?(agent)
  agent.products[-1] == "Safari" ||
  agent.products[0] == "Safari" ||
  (agent.products == ["Mozilla", "AppleWebKit", "Mobile"] && Aua::OperatingSystems::IOS::PLATFORMS.include?(agent.platform_string)) ||
  agent.products.include?("OmniWeb") ||
  agent.products[0] == "MobileSafari"
end

Instance Method Details

#nameObject



46
47
48
49
50
51
52
53
# File 'lib/aua/agents/safari.rb', line 46

def name
  @name ||= begin
    return :MobileSafari if products.include?("Mobile") || products[0] == "MobileSafari"
    return :Fluid if products.include?("Fluid") || products.include?("FluidApp")
    return :OmniWeb if products.include?("OmniWeb")
    :Safari
  end
end

#typeObject



42
43
44
# File 'lib/aua/agents/safari.rb', line 42

def type
  :Browser
end

#versionObject



55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/aua/agents/safari.rb', line 55

def version
  @version ||= begin
    case name
    when :OmniWeb
      version_of(name)
    else
      (name == :Fluid && version_of(:Fluid)) ||
      version_of("Version") || BUILDS[version_of("Safari")] ||
      version_of("Mobile") || version_of("MobileSafari") || version_of("Safari")
    end
  end
end