Module: Aua::Agents::Firefox

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

Constant Summary collapse

PATTERN =
/^(Firefox|(p|P)rism|SeaMonkey|Camino|Iceweasel|Thunderbird|Epiphany|Namoroka|Flock|Navigator|Netscape)/

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extend?(agent) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/aua/agents/firefox.rb', line 4

def self.extend?(agent)
  agent.products.find{|product| product =~ PATTERN}
end

Instance Method Details

#nameObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/aua/agents/firefox.rb', line 12

def name
  @name ||= begin
    if products.include?("Prism")  || products.include?("prism")
      products[products.index("prism")] = "Prism" if products.include?("prism")
      return :Prism
    end
    return :Camino if products.include?("Camino")
    return :SeaMonkey if products.include?("SeaMonkey")
    return :Iceweasel if products.include?("Iceweasel")
    return :Thunderbird if products.include?("Thunderbird")
    return :Epiphany if products.include?("Epiphany")
    return :Flock if products.include?("Flock")
    return :NetscapeNavigator if products.include?("Navigator") || products.include?("Netscape")
    if p = products.find{|product| product =~ /^Firefox-/}
      products[products.index(p)] = "Firefox"
    end
    :Firefox
  end
end

#typeObject



8
9
10
# File 'lib/aua/agents/firefox.rb', line 8

def type
  :Browser
end

#versionObject



32
33
34
35
36
37
38
39
# File 'lib/aua/agents/firefox.rb', line 32

def version
  @version ||= begin
    return version_of("Namoroka") if products.include?("Namoroka")
    return version_of("Netscape") if products.include?("Netscape")
    return version_of("Navigator") if products.include?("Navigator")
    super
  end
end