Sha256: 48ec3a4be3e60436627da2505fab42a5d6ca3b513b825ff5d6cc797e9c1d5e28

Contents?: true

Size: 563 Bytes

Versions: 4

Compression:

Stored size: 563 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 =~ /Chrome|CriOS/ &&
        ua !~ /PhantomJS|FxiOS|YaBrowser|SputnikBrowser|ArchiveBot/ &&
        !opera? &&
        !edge?
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
browser-3.0.3 lib/browser/chrome.rb
browser-3.0.2 lib/browser/chrome.rb
browser-3.0.1 lib/browser/chrome.rb
browser-3.0.0 lib/browser/chrome.rb