Module: UserAgent::Browsers::Gecko

Defined in:
lib/user_agent/browsers/gecko.rb

Constant Summary collapse

GeckoBrowsers =
%w(
  Firefox
  Camino
  Iceweasel
  Seamonkey
).freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extend?(agent) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/user_agent/browsers/gecko.rb', line 4

def self.extend?(agent)
  agent.application && agent.application.product == "Mozilla"
end

Instance Method Details

#browserObject



15
16
17
# File 'lib/user_agent/browsers/gecko.rb', line 15

def browser
  GeckoBrowsers.detect { |browser| respond_to?(browser) } || super
end

#localizationObject



53
54
55
56
57
# File 'lib/user_agent/browsers/gecko.rb', line 53

def localization
  if comment = application.comment
    comment[3]
  end
end

#osObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/user_agent/browsers/gecko.rb', line 37

def os
  if comment = application.comment
    i =
      if comment[1] == "U"
        2
      else
        if comment[1] == "WOW64"
          0
        else
          1
        end
      end
    OperatingSystems.normalize_os(comment[i])
  end
end

#platformObject



23
24
25
26
27
28
29
30
31
# File 'lib/user_agent/browsers/gecko.rb', line 23

def platform
  if comment = application.comment
    if comment[0] =~ /Windows/
      "Windows"
    else
      comment[0] == 'compatible' ? nil : comment[0]
    end
  end
end

#securityObject



33
34
35
# File 'lib/user_agent/browsers/gecko.rb', line 33

def security
  Security[application.comment[1]] || :strong
end

#versionObject



19
20
21
# File 'lib/user_agent/browsers/gecko.rb', line 19

def version
  send(browser).version || super
end