File: edge.rb

package info (click to toggle)
ruby-useragent 0.16.8-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 368 kB
  • sloc: ruby: 4,824; makefile: 2
file content (33 lines) | stat: -rw-r--r-- 541 bytes parent folder | download | duplicates (3)
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
26
27
28
29
30
31
32
33
class UserAgent
  module Browsers
    class Edge < Base
      OS_REGEXP = /Windows NT [\d\.]+|Windows Phone (OS )?[\d\.]+/

      def self.extend?(agent)
        agent.last && agent.last.product == "Edge"
      end

      def browser
        "Edge"
      end

      def version
        last.version
      end

      def platform
        "Windows"
      end

      def os
        OperatingSystems.normalize_os(os_comment)
      end

      private

      def os_comment
        detect_comment_match(OS_REGEXP).to_s
      end
    end
  end
end