Sha256: d7eae3267c59d8e6fe8a2b5d79e0554068af6fa73f80a3b1cd632edd5fcc332c
Contents?: true
Size: 785 Bytes
Versions: 4
Compression:
Stored size: 785 Bytes
Contents
# frozen_string_literal: true module Browser class Platform class IOS < Base MATCHER = /(iPhone|iPad|iPod)/.freeze VERSION_MATCHER = /OS (?<major>\d+)_(?<minor>\d+)_?(?<patch>\d+)?/.freeze def version matches = VERSION_MATCHER.match(ua) return "0" unless matches versions = [matches[:major]] if matches[:patch] versions.push(matches[:minor], matches[:patch]) else versions.push(matches[:minor]) unless matches[:minor] == "0" end versions.join(".") end def name "iOS (#{device})" end def id :ios end def match? ua.match?(MATCHER) end def device ua[MATCHER, 1] end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
browser-6.0.0 | lib/browser/platform/ios.rb |
browser-5.3.1 | lib/browser/platform/ios.rb |
browser-5.3.0 | lib/browser/platform/ios.rb |
browser-5.2.0 | lib/browser/platform/ios.rb |