Sha256: 7809ab6c4fe702592ba5c3808cfbb50b84013a96ce7bece9d2f034efeb0c4b4a

Contents?: true

Size: 1.2 KB

Versions: 9

Compression:

Stored size: 1.2 KB

Contents

class UserAgent
  module Browsers
    class Gecko < Base
      def self.extend?(agent)
        agent.application && agent.application.product == "Mozilla"
      end

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

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

      def version
        v = send(browser).version
        v.nil? ? super : v
      end

      def platform
        if comment = application.comment
          if comment[0] == 'compatible'
            nil
          elsif /^Windows / =~ comment[0]
            'Windows'
          else
            comment[0]
          end
        end
      end

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

      def os
        if comment = application.comment
          i = if comment[1] == 'U'
            2
          elsif /^Windows / =~ comment[0]
            0
          else
            1
          end

          OperatingSystems.normalize_os(comment[i])
        end
      end

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
useragent-0.15.2 lib/user_agent/browsers/gecko.rb
useragent-0.15.1 lib/user_agent/browsers/gecko.rb
useragent-0.15.0 lib/user_agent/browsers/gecko.rb
useragent-0.14.0 lib/user_agent/browsers/gecko.rb
useragent-0.13.3 lib/user_agent/browsers/gecko.rb
useragent-0.13.2 lib/user_agent/browsers/gecko.rb
useragent-0.13.1 lib/user_agent/browsers/gecko.rb
useragent-0.13.0 lib/user_agent/browsers/gecko.rb
useragent-0.12.0 lib/user_agent/browsers/gecko.rb