browser 5.1.0 → 5.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/tests.yml +57 -0
  3. data/.rubocop.yml +3 -0
  4. data/CHANGELOG.md +5 -0
  5. data/README.md +3 -3
  6. data/browser.gemspec +3 -3
  7. data/lib/browser/accept_language.rb +4 -4
  8. data/lib/browser/alipay.rb +1 -1
  9. data/lib/browser/base.rb +12 -8
  10. data/lib/browser/blackberry.rb +1 -1
  11. data/lib/browser/bot/keyword_matcher.rb +1 -1
  12. data/lib/browser/browser.rb +1 -2
  13. data/lib/browser/chrome.rb +2 -2
  14. data/lib/browser/device.rb +4 -4
  15. data/lib/browser/device/android.rb +1 -1
  16. data/lib/browser/device/blackberry_playbook.rb +1 -1
  17. data/lib/browser/device/ipad.rb +1 -1
  18. data/lib/browser/device/iphone.rb +1 -1
  19. data/lib/browser/device/ipod_touch.rb +1 -1
  20. data/lib/browser/device/kindle.rb +1 -1
  21. data/lib/browser/device/kindle_fire.rb +1 -1
  22. data/lib/browser/device/playstation3.rb +1 -1
  23. data/lib/browser/device/playstation4.rb +1 -1
  24. data/lib/browser/device/psp.rb +1 -1
  25. data/lib/browser/device/psvita.rb +1 -1
  26. data/lib/browser/device/surface.rb +1 -1
  27. data/lib/browser/device/switch.rb +1 -1
  28. data/lib/browser/device/tv.rb +1 -1
  29. data/lib/browser/device/wii.rb +1 -1
  30. data/lib/browser/device/wiiu.rb +1 -1
  31. data/lib/browser/device/xbox_360.rb +1 -1
  32. data/lib/browser/device/xbox_one.rb +1 -1
  33. data/lib/browser/duck_duck_go.rb +1 -1
  34. data/lib/browser/edge.rb +2 -2
  35. data/lib/browser/electron.rb +1 -1
  36. data/lib/browser/facebook.rb +1 -1
  37. data/lib/browser/firefox.rb +1 -1
  38. data/lib/browser/google_search_app.rb +1 -1
  39. data/lib/browser/huawei_browser.rb +1 -1
  40. data/lib/browser/instagram.rb +1 -1
  41. data/lib/browser/internet_explorer.rb +2 -2
  42. data/lib/browser/maxthon.rb +1 -1
  43. data/lib/browser/micro_messenger.rb +1 -1
  44. data/lib/browser/miui_browser.rb +1 -1
  45. data/lib/browser/nokia.rb +1 -1
  46. data/lib/browser/opera.rb +1 -1
  47. data/lib/browser/otter.rb +1 -1
  48. data/lib/browser/phantom_js.rb +1 -1
  49. data/lib/browser/platform.rb +17 -11
  50. data/lib/browser/platform/adobe_air.rb +1 -1
  51. data/lib/browser/platform/android.rb +1 -1
  52. data/lib/browser/platform/blackberry.rb +1 -1
  53. data/lib/browser/platform/chrome_os.rb +1 -1
  54. data/lib/browser/platform/firefox_os.rb +1 -1
  55. data/lib/browser/platform/ios.rb +1 -1
  56. data/lib/browser/platform/kai_os.rb +23 -0
  57. data/lib/browser/platform/linux.rb +1 -1
  58. data/lib/browser/platform/mac.rb +1 -1
  59. data/lib/browser/platform/windows.rb +1 -1
  60. data/lib/browser/platform/windows_mobile.rb +1 -1
  61. data/lib/browser/platform/windows_phone.rb +1 -1
  62. data/lib/browser/qq.rb +1 -1
  63. data/lib/browser/safari.rb +2 -2
  64. data/lib/browser/samsung_browser.rb +1 -1
  65. data/lib/browser/snapchat.rb +1 -1
  66. data/lib/browser/sougou_browser.rb +1 -1
  67. data/lib/browser/sputnik.rb +1 -1
  68. data/lib/browser/uc_browser.rb +1 -1
  69. data/lib/browser/version.rb +1 -1
  70. data/lib/browser/weibo.rb +1 -1
  71. data/lib/browser/yandex.rb +1 -1
  72. data/test/ua.yml +2 -0
  73. data/test/unit/bots_test.rb +1 -1
  74. data/test/unit/device_test.rb +1 -1
  75. data/test/unit/kai_os_test.rb +31 -0
  76. data/test/unit/meta_test.rb +1 -1
  77. data/test/unit/platform_test.rb +1 -1
  78. metadata +12 -9
  79. data/.travis.yml +0 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e5b6ed4dfb725a6d4814c3bd7a0a3897c0fe4fdeb9679d048cbb42123d6117c
4
- data.tar.gz: b053a5fcf79d5fbea19849bde05125598563ac1b754dcd661f8c9fb96df2f3d4
3
+ metadata.gz: e96d048b4f2fa2c1c6abe602294dbfef45fff3fc2d12aee75081d55ecced4e2f
4
+ data.tar.gz: 48f5cd0b90d5f65420306ec63da2d5484a0176abc9f8ab57f6b13c1610d79eb1
5
5
  SHA512:
6
- metadata.gz: 9ea11931654143308193198a53edf5009dd301e04610e736c7da191c16c3578dd96df95213c787591f916859f604e01a61ef6baf12744a5ad84499dcaf93bf57
7
- data.tar.gz: 7983885eca85b9cf2812f37b291020b2a8ef9ba3a7ee1a44f2a28e643fb786e6565d2a9394f57728c0444d82dc0ca7655eb6568b12578d9e50d8d191d7ca20c9
6
+ metadata.gz: 2a9d718a2306e5216b9f706cba1894fe6d0940863336a648e3d0781158b2f1f5ef3a33bceeaf6d1a8727b6980b801859f48c3e95fa13763d738c9d97d31f4944
7
+ data.tar.gz: 48ba58451e08e138c2b73a0cab7f320f9e1eeb2ff907b9eaf9cff01370e70e6a3e11995880fddb456e87cff0e23bab9c93e09438dce0ebd990510b10029707cc
@@ -0,0 +1,57 @@
1
+ name: Tests
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+ push:
8
+ branches:
9
+ - main
10
+
11
+ schedule:
12
+ - cron: "0 10 * * *"
13
+
14
+ jobs:
15
+ build:
16
+ name: Tests with Ruby ${{ matrix.ruby }} and ${{ matrix.gemfile }}
17
+ runs-on: "ubuntu-latest"
18
+ strategy:
19
+ fail-fast: false
20
+ matrix:
21
+ ruby: ["2.7.x", "2.6.x", "2.5.x"]
22
+ gemfile:
23
+ - Gemfile
24
+ - gemfiles/rails5.gemfile
25
+ - gemfiles/rails6.gemfile
26
+
27
+ steps:
28
+ - uses: actions/checkout@v1
29
+
30
+ - uses: actions/cache@v2
31
+ with:
32
+ path: vendor/bundle
33
+ key: >
34
+ ${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles(matrix.gemfile) }}
35
+ restore-keys: >
36
+ ${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles(matrix.gemfile) }}
37
+
38
+ - name: Set up Ruby
39
+ uses: actions/setup-ruby@v1
40
+ with:
41
+ ruby-version: ${{ matrix.ruby }}
42
+
43
+ - name: Install gem dependencies
44
+ env:
45
+ RAILS_ENV: test
46
+ BUNDLE_GEMFILE: ${{ matrix.gemfile }}
47
+ run: |
48
+ gem install bundler
49
+ bundle config path vendor/bundle
50
+ bundle update --jobs 4 --retry 3
51
+
52
+ - name: Run Tests
53
+ env:
54
+ RAILS_ENV: test
55
+ BUNDLE_GEMFILE: ${{ matrix.gemfile }}
56
+ run: |
57
+ bundle exec rake
@@ -36,3 +36,6 @@ Metrics/CyclomaticComplexity:
36
36
 
37
37
  Metrics/PerceivedComplexity:
38
38
  Enabled: false
39
+
40
+ Naming/VariableNumber:
41
+ Enabled: false
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.2.0
4
+
5
+ - Add KaiOS detection.
6
+ - Replace `String#=~` with `String#match?` and other optimizations.
7
+
3
8
  ## 5.1.0
4
9
 
5
10
  - Add Samsung device detection.
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  # Browser
2
2
 
3
- [![Travis-CI](https://travis-ci.org/fnando/browser.svg)](https://travis-ci.org/fnando/browser)
3
+ [![Tests](https://github.com/fnando/browser/workflows/Tests/badge.svg)](https://github.com/fnando/browser)
4
4
  [![Code Climate](https://codeclimate.com/github/fnando/browser/badges/gpa.svg)](https://codeclimate.com/github/fnando/browser)
5
- [![Test Coverage](https://codeclimate.com/github/fnando/browser/badges/coverage.svg)](https://codeclimate.com/github/fnando/browser/coverage)
6
5
  [![Gem](https://img.shields.io/gem/v/browser.svg)](https://rubygems.org/gems/browser)
7
6
  [![Gem](https://img.shields.io/gem/dt/browser.svg)](https://rubygems.org/gems/browser)
8
7
 
@@ -131,6 +130,7 @@ browser.platform.windows_wow64?
131
130
  browser.platform.windows_x64?
132
131
  browser.platform.windows_x64_inclusive?
133
132
  browser.platform.windows_xp?
133
+ browser.platform.kai_os?
134
134
  ```
135
135
 
136
136
  ### Aliases
@@ -305,7 +305,7 @@ To add custom matchers, you can add a callable object to
305
305
  `externalhit` substring on it. The bot name will always be `General Bot`.
306
306
 
307
307
  ```ruby
308
- Browser::Bot.matchers << ->(ua, _browser) { ua =~ /externalhit/i }
308
+ Browser::Bot.matchers << ->(ua, _browser) { ua.match?(/externalhit/i) }
309
309
  ```
310
310
 
311
311
  To clear all matchers, including the ones that are bundled, use
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
13
13
  s.description = s.summary
14
14
  s.license = "MIT"
15
15
 
16
- s.metadata["changelog_uri"] = "https://github.com/fnando/browser/blob/master/CHANGELOG.md"
17
-
16
+ s.metadata["changelog_uri"] = "https://github.com/fnando/browser/blob/main/CHANGELOG.md"
17
+
18
18
  s.files = `git ls-files`.split("\n")
19
19
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
20
20
  s.executables = `git ls-files -- exe/*`
@@ -31,6 +31,6 @@ Gem::Specification.new do |s|
31
31
  s.add_development_dependency "rails"
32
32
  s.add_development_dependency "rake"
33
33
  s.add_development_dependency "rubocop"
34
- s.add_development_dependency "rubocop-fnando", "~> 0.0.3"
34
+ s.add_development_dependency "rubocop-fnando"
35
35
  s.add_development_dependency "simplecov"
36
36
  end
@@ -48,15 +48,15 @@ module Browser
48
48
  def quality
49
49
  @quality ||= begin
50
50
  Float(quality_value || 1.0)
51
- rescue ArgumentError
52
- 0.1
51
+ rescue ArgumentError
52
+ 0.1
53
53
  end
54
54
  end
55
55
 
56
56
  private def quality_value
57
57
  qvalue = part[/;q=([\d.]+)/, 1]
58
- qvalue = qvalue =~ /\A0\.0?\z/ ? "0.0" : qvalue
59
- qvalue = qvalue.gsub(/\.+/, ".") if qvalue
58
+ qvalue = /\A0\.0?\z/.match?(qvalue) ? "0.0" : qvalue
59
+ qvalue = qvalue.squeeze(".") if qvalue
60
60
  qvalue
61
61
  end
62
62
  end
@@ -15,7 +15,7 @@ module Browser
15
15
  end
16
16
 
17
17
  def match?
18
- ua =~ /AlipayClient/i
18
+ ua.match?(/AlipayClient/i)
19
19
  end
20
20
  end
21
21
  end
@@ -106,19 +106,20 @@ module Browser
106
106
 
107
107
  # Detect if browser is WebKit-based.
108
108
  def webkit?(expected_version = nil)
109
- ua =~ /AppleWebKit/i &&
109
+ ua.match?(/AppleWebKit/i) &&
110
110
  (!edge? || Edge.new(ua).chrome_based?) &&
111
111
  detect_version?(webkit_full_version, expected_version)
112
112
  end
113
113
 
114
114
  # Detect if browser is QuickTime
115
115
  def quicktime?(expected_version = nil)
116
- ua =~ /QuickTime/i && detect_version?(full_version, expected_version)
116
+ ua.match?(/QuickTime/i) && detect_version?(full_version, expected_version)
117
117
  end
118
118
 
119
119
  # Detect if browser is Apple CoreMedia.
120
120
  def core_media?(expected_version = nil)
121
- ua =~ /CoreMedia/ && detect_version?(full_version, expected_version)
121
+ ua.include?("CoreMedia") && detect_version?(full_version,
122
+ expected_version)
122
123
  end
123
124
 
124
125
  # Detect if browser is PhantomJS
@@ -133,7 +134,7 @@ module Browser
133
134
  end
134
135
 
135
136
  def safari_webapp_mode?
136
- (device.ipad? || device.iphone?) && ua =~ /AppleWebKit/
137
+ (device.ipad? || device.iphone?) && ua.include?("AppleWebKit")
137
138
  end
138
139
 
139
140
  # Detect if browser is Firefox.
@@ -191,17 +192,20 @@ module Browser
191
192
 
192
193
  # Detect if browser is Opera Mini.
193
194
  def opera_mini?(expected_version = nil)
194
- ua =~ /Opera Mini/ && detect_version?(full_version, expected_version)
195
+ ua.include?("Opera Mini") && detect_version?(full_version,
196
+ expected_version)
195
197
  end
196
198
 
197
199
  # Detect if browser is DuckDuckGo.
198
200
  def duck_duck_go?(expected_version = nil)
199
- ua =~ /DuckDuckGo/ && detect_version?(full_version, expected_version)
201
+ ua.include?("DuckDuckGo") && detect_version?(full_version,
202
+ expected_version)
200
203
  end
201
204
 
202
205
  # Detect if browser is Samsung.
203
206
  def samsung_browser?(expected_version = nil)
204
- ua =~ /SamsungBrowser/ && detect_version?(full_version, expected_version)
207
+ ua.include?("SamsungBrowser") && detect_version?(full_version,
208
+ expected_version)
205
209
  end
206
210
 
207
211
  # Detect if browser is Huawei.
@@ -234,7 +238,7 @@ module Browser
234
238
 
235
239
  # Detect if browser is Google Search App
236
240
  def google_search_app?(expected_version = nil)
237
- ua =~ /GSA/ && detect_version?(full_version, expected_version)
241
+ ua.include?("GSA") && detect_version?(full_version, expected_version)
238
242
  end
239
243
 
240
244
  def webkit_full_version
@@ -17,7 +17,7 @@ module Browser
17
17
  end
18
18
 
19
19
  def match?
20
- ua =~ /BlackBerry|BB10/
20
+ ua.match?(/BlackBerry|BB10/)
21
21
  end
22
22
  end
23
23
  end
@@ -4,7 +4,7 @@ module Browser
4
4
  class Bot
5
5
  class KeywordMatcher
6
6
  def self.call(ua, _browser)
7
- ua =~ /crawl|fetch|search|monitoring|spider|bot/
7
+ ua.match?(/crawl|fetch|search|monitoring|spider|bot/)
8
8
  end
9
9
  end
10
10
  end
@@ -58,8 +58,7 @@ module Browser
58
58
  end
59
59
 
60
60
  class << self
61
- attr_accessor :user_agent_size_limit
62
- attr_accessor :accept_language_size_limit
61
+ attr_accessor :user_agent_size_limit, :accept_language_size_limit
63
62
  end
64
63
 
65
64
  self.user_agent_size_limit = 2048
@@ -20,8 +20,8 @@ module Browser
20
20
  end
21
21
 
22
22
  def match?
23
- ua =~ /Chrome|CriOS/ &&
24
- ua !~ /PhantomJS|FxiOS|ArchiveBot/ &&
23
+ ua.match?(/Chrome|CriOS/) &&
24
+ !ua.match?(/PhantomJS|FxiOS|ArchiveBot/) &&
25
25
  !opera? &&
26
26
  !edge? &&
27
27
  !duck_duck_go? &&
@@ -160,12 +160,12 @@ module Browser
160
160
 
161
161
  # Detect if browser is Silk.
162
162
  def silk?
163
- ua =~ /Silk/
163
+ ua.include?("Silk")
164
164
  end
165
165
 
166
166
  # Detect if browser is running under Xbox.
167
167
  def xbox?
168
- ua =~ /Xbox/
168
+ ua.include?("Xbox")
169
169
  end
170
170
 
171
171
  # Detect if browser is running under Xbox 360.
@@ -202,9 +202,9 @@ module Browser
202
202
  # rubocop:disable Layout/LineLength
203
203
  private def detect_mobile?
204
204
  psp? ||
205
- /zunewp7/i.match(ua) ||
205
+ /zunewp7/i.match?(ua) ||
206
206
  %r{(android|bb\d+|meego).+mobile|avantgo|bada/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino}i.match(ua) ||
207
- %r{1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-}i.match(ua[0..3])
207
+ %r{1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-}i.match?(ua[0..3])
208
208
  end
209
209
  # rubocop:enable Layout/LineLength
210
210
 
@@ -13,7 +13,7 @@ module Browser
13
13
  end
14
14
 
15
15
  def match?
16
- ua =~ /Android/
16
+ ua.include?("Android")
17
17
  end
18
18
  end
19
19
  end
@@ -12,7 +12,7 @@ module Browser
12
12
  end
13
13
 
14
14
  def match?
15
- ua =~ /PlayBook.*?RIM Tablet/
15
+ ua.match?(/PlayBook.*?RIM Tablet/)
16
16
  end
17
17
  end
18
18
  end
@@ -12,7 +12,7 @@ module Browser
12
12
  end
13
13
 
14
14
  def match?
15
- ua =~ /iPad/
15
+ ua.include?("iPad")
16
16
  end
17
17
  end
18
18
  end
@@ -12,7 +12,7 @@ module Browser
12
12
  end
13
13
 
14
14
  def match?
15
- ua =~ /iPhone/
15
+ ua.include?("iPhone")
16
16
  end
17
17
  end
18
18
  end
@@ -12,7 +12,7 @@ module Browser
12
12
  end
13
13
 
14
14
  def match?
15
- ua =~ /iPod/
15
+ ua.include?("iPod")
16
16
  end
17
17
  end
18
18
  end
@@ -12,7 +12,7 @@ module Browser
12
12
  end
13
13
 
14
14
  def match?
15
- ua =~ /Kindle/
15
+ ua.include?("Kindle")
16
16
  end
17
17
  end
18
18
  end
@@ -12,7 +12,7 @@ module Browser
12
12
  end
13
13
 
14
14
  def match?
15
- ua =~ /Kindle Fire|KFTT/
15
+ ua.match?(/Kindle Fire|KFTT/)
16
16
  end
17
17
  end
18
18
  end
@@ -12,7 +12,7 @@ module Browser
12
12
  end
13
13
 
14
14
  def match?
15
- ua =~ /PLAYSTATION 3/i
15
+ ua.match?(/PLAYSTATION 3/i)
16
16
  end
17
17
  end
18
18
  end
@@ -12,7 +12,7 @@ module Browser
12
12
  end
13
13
 
14
14
  def match?
15
- ua =~ /PLAYSTATION 4/i
15
+ ua.match?(/PLAYSTATION 4/i)
16
16
  end
17
17
  end
18
18
  end
@@ -12,7 +12,7 @@ module Browser
12
12
  end
13
13
 
14
14
  def match?
15
- ua =~ /PlayStation Portable/
15
+ ua.include?("PlayStation Portable")
16
16
  end
17
17
  end
18
18
  end
@@ -12,7 +12,7 @@ module Browser
12
12
  end
13
13
 
14
14
  def match?
15
- ua =~ /Playstation Vita/
15
+ ua.match?("Playstation Vita")
16
16
  end
17
17
  end
18
18
  end
@@ -12,7 +12,7 @@ module Browser
12
12
  end
13
13
 
14
14
  def match?
15
- platform.windows_rt? && ua =~ /Touch/
15
+ platform.windows_rt? && ua.include?("Touch")
16
16
  end
17
17
 
18
18
  private def platform
@@ -12,7 +12,7 @@ module Browser
12
12
  end
13
13
 
14
14
  def match?
15
- ua =~ /Nintendo Switch/i
15
+ ua.match?(/Nintendo Switch/i)
16
16
  end
17
17
  end
18
18
  end
@@ -12,7 +12,7 @@ module Browser
12
12
  end
13
13
 
14
14
  def match?
15
- ua =~ /(\btv|Android.*?ADT-1|Nexus Player)/i
15
+ ua.match?(/(\btv|Android.*?ADT-1|Nexus Player)/i)
16
16
  end
17
17
  end
18
18
  end
@@ -12,7 +12,7 @@ module Browser
12
12
  end
13
13
 
14
14
  def match?
15
- ua =~ /Nintendo Wii/i
15
+ ua.match?(/Nintendo Wii/i)
16
16
  end
17
17
  end
18
18
  end