File: mac.rb

package info (click to toggle)
ruby-browser 5.3.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 872 kB
  • sloc: ruby: 4,752; makefile: 13
file content (25 lines) | stat: -rw-r--r-- 382 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true

module Browser
  class Platform
    class Mac < Base
      def version
        (ua[/Mac OS X\s*([0-9_.]+)?/, 1] || "0").tr("_", ".")
      end

      def name
        return "macOS" if platform.mac?(">= 10.12")

        "Mac OS X"
      end

      def id
        :mac
      end

      def match?
        ua.include?("Mac")
      end
    end
  end
end