Sha256: 2e083e444bb8b94f4005a26bff8326b85ba004292779d99015f5020dd181923a

Contents?: true

Size: 795 Bytes

Versions: 3

Compression:

Stored size: 795 Bytes

Contents

# frozen_string_literal: true

module Browser
  class Chrome < Base
    def id
      :chrome
    end

    def name
      "Chrome"
    end

    def full_version
      # Each regex on its own line to enforce precedence.
      ua[%r{Chrome/([\d.]+)}, 1] ||
        ua[%r{CriOS/([\d.]+)}, 1] ||
        ua[%r{Safari/([\d.]+)}, 1] ||
        ua[%r{AppleWebKit/([\d.]+)}, 1] ||
        "0.0"
    end

    def match?
      ua.match?(/Chrome|CriOS/) &&
        !ua.match?(/PhantomJS|FxiOS|ArchiveBot/) &&
        !opera? &&
        !edge? &&
        !duck_duck_go? &&
        !yandex? &&
        !sputnik? &&
        !samsung_browser? &&
        !huawei_browser? &&
        !miui_browser? &&
        !maxthon? &&
        !qq? &&
        !sougou_browser? &&
        !google_search_app?
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
browser-5.3.1 lib/browser/chrome.rb
browser-5.3.0 lib/browser/chrome.rb
browser-5.2.0 lib/browser/chrome.rb