Sha256: 51d2effaae58f3b3a2570503d862859a55385300ba3895165eecc7123dfcf12d

Contents?: true

Size: 575 Bytes

Versions: 6

Compression:

Stored size: 575 Bytes

Contents

# frozen_string_literal: true

module Browser
  class Device
    class Samsung < Base
      REGEX = /\(Linux.*?; Android.*?; (SAMSUNG )?(SM-[A-Z0-9]+).*?\)/i.freeze

      def self.names
        @names ||= YAML.load_file(Browser.root.join("samsung.yml").to_s)
      end

      def id
        :samsung
      end

      def name
        "Samsung #{self.class.names[code] || code}"
      end

      def code
        matches && matches[2]
      end

      def matches
        @matches ||= ua.match(REGEX)
      end

      def match?
        !!matches
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
browser-6.1.0 lib/browser/device/samsung.rb
browser-6.0.0 lib/browser/device/samsung.rb
browser-5.3.1 lib/browser/device/samsung.rb
browser-5.3.0 lib/browser/device/samsung.rb
browser-5.2.0 lib/browser/device/samsung.rb
browser-5.1.0 lib/browser/device/samsung.rb