browserino 2.5.1 → 2.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8174f4d5d67aa2a3e8d67fa4bc68f0a6507ff6ce
4
- data.tar.gz: 796ee7682e4d20750377ca2259845ccb0898e46f
3
+ metadata.gz: 9a9d892c5ad880cdc418ac696b69dd465ec03820
4
+ data.tar.gz: 9addf30f035f5c74ada82cf47151c6ec9816667e
5
5
  SHA512:
6
- metadata.gz: 9f2fecfa569f5a93d3284409326ebc5f3e3dd55aa1e76253c8802b1ef85c5b8896204272a81d84a7247e0f48adbdf5cdd3af24e2e1944c1156da987328a7feac
7
- data.tar.gz: 1c131875416bbe641f9a71a552ec790ba864a9c32aafd1a51959a72dcf68aa81acd57da679ee9aabb6f1daafbed87a875f2b5b354c90b5812b0db6dd0f7455e9
6
+ metadata.gz: e9276a510795d45e68ae8e717c07d340258c2f956e2b778fb4d2c632ba45dccc53e256f020cc8eb2be888f515ae2fbc23d70d00ef7d74f91505c38fb2383ee69
7
+ data.tar.gz: ff0ca377b67f2a492d3abce13b2c864a85f02077af6c8e49b5d021652e7238a0b8c0e38f32adef4b01cc7b6f5f1249b6aff1fc0f3b52871cc48a11ad29383750
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  ## CHANGELOG
2
2
  _dates are in dd-mm-yyyy format_
3
3
 
4
+ #### 11-01-2016 VERSION 2.4.1(.1)
5
+
6
+ - Caching the agent object in Rails
7
+ - **DEPRECATE** Using a custom return value for when a property isn't found
8
+
4
9
  #### 10-01-2016 VERSION 2.4.0
5
10
 
6
11
  - Added rails integration
data/README.md CHANGED
@@ -10,6 +10,12 @@ This gem aims to provide information about the browser that your visitor is usin
10
10
  _dates are in dd-mm-yyyy format_
11
11
  _older changes can be found in the [CHANGELOG.md](https://github.com/SidOfc/browserino/blob/master/CHANGELOG.md)_
12
12
 
13
+ #### 15-01-2016 VERSION 2.5.2
14
+
15
+ - **DEPRECATE** Custom return values (passed through `Browserino::parse`) will no longer alter the output of the agent object
16
+ - Added support for windows phone detection
17
+ - Added `windows_phone?` method
18
+
13
19
  #### 12-01-2016 VERSION 2.5.1
14
20
 
15
21
  - Patched blackberry mapping, this used to be done by model number instead but is now corrected
@@ -22,11 +28,6 @@ _older changes can be found in the [CHANGELOG.md](https://github.com/SidOfc/brow
22
28
  - New method `#bsd?`
23
29
  - Fixed using symbols for system version identification (e.g. `:vista` or `:el_capitan`) without a version number
24
30
 
25
- #### 11-01-2016 VERSION 2.4.1(.1)
26
-
27
- - Caching the agent object in Rails
28
- - **DEPRECATE** Using a custom return value for when a property isn't found
29
-
30
31
  ## Installation
31
32
 
32
33
  *supports ruby 1.9.3+*
@@ -97,6 +98,7 @@ agent.engine_version
97
98
 
98
99
  agent.system_name
99
100
  # => 'macintosh'
101
+ # possibilities are macintosh, windows, blackberry, android, linux, bsd and ios
100
102
 
101
103
  # or optionally, the full name (guessed from OS version)
102
104
  agent.system_name full: true
@@ -221,6 +223,8 @@ agent.macintosh?
221
223
 
222
224
  agent.blackberry?
223
225
 
226
+ agent.windows_phone?
227
+
224
228
  agent.linux? # linux doesn't have versions
225
229
 
226
230
  agent.bsd? # bsd also doesn't have versions
@@ -256,6 +260,8 @@ agent.not.macintosh?
256
260
 
257
261
  agent.not.blackberry?
258
262
 
263
+ agent.not.windows_phone?
264
+
259
265
  agent.not.linux?
260
266
 
261
267
  agent.not.bsd?
@@ -436,6 +442,8 @@ Valid browser names are defined by __/lib/browserino/patterns.rb__ (the keys are
436
442
 
437
443
  'bb'
438
444
 
445
+ 'windows_phone'
446
+
439
447
  'android'
440
448
 
441
449
  'ios'
@@ -2,7 +2,6 @@ module Browserino
2
2
  class Agent
3
3
  def initialize(ua, unknown = Browserino::UNKNOWN)
4
4
  @ua = ua
5
- @unknown = unknown
6
5
  @not = false
7
6
 
8
7
  cleansed_ua = Browserino::strip_lies @ua
@@ -97,7 +96,7 @@ module Browserino
97
96
  end
98
97
 
99
98
  def known?
100
- allow_inverted_return (browser_name != @unknown || bot_name != @unknown)
99
+ allow_inverted_return (browser_name != Browserino::UNKNOWN || bot_name != Browserino::UNKNOWN)
101
100
  end
102
101
 
103
102
  def mobile?
@@ -233,18 +232,18 @@ module Browserino
233
232
  def with_valid(val)
234
233
  if val && (val != '' || val != false) && block_given?
235
234
  res = yield(val)
236
- return @unknown if res == ''
235
+ return Browserino::UNKNOWN if res == ''
237
236
  res
238
237
  else
239
- @unknown
238
+ Browserino::UNKNOWN
240
239
  end
241
240
  end
242
241
 
243
242
  def fetch_system_version_name(name)
244
- return @unknown if name.nil? || name == '' || !name
245
- const = name.upcase
243
+ return Browserino::UNKNOWN if name.nil? || name == '' || !name
244
+ const = name.upcase.gsub(/\s/, '_')
246
245
  name.downcase!
247
- version = if system_version == @unknown
246
+ version = if system_version == Browserino::UNKNOWN
248
247
  nil
249
248
  elsif name.match(/mac|ios|blackberry/i)
250
249
  system_version.split('.').first(2).join.to_i
@@ -259,7 +258,7 @@ module Browserino
259
258
  end
260
259
  version_names.keys.first || system_version.split('.').first(2).join('.')
261
260
  else
262
- @unknown
261
+ Browserino::UNKNOWN
263
262
  end
264
263
  end
265
264
  end
@@ -9,7 +9,8 @@ module Browserino
9
9
  },
10
10
  engine_version: {},
11
11
  system_name: {
12
- 'linux' => ['ubuntu', 'x11']
12
+ 'linux' => ['ubuntu', 'x11'],
13
+ 'windows_phone' => ['windows phone os', 'windows phone']
13
14
  },
14
15
  system_version: {},
15
16
  system_architecture: {
@@ -0,0 +1,5 @@
1
+ module Browserino
2
+ module Mapping
3
+ WINDOWS_PHONE = {}
4
+ end
5
+ end
@@ -84,10 +84,10 @@ module Browserino
84
84
  },
85
85
 
86
86
  operating_system: {
87
- name: /(?<name>windows|macintosh|android|ios|blackberry|linux|ubuntu|x11|bsd)/i,
88
- version: /(?:nt|mac\sos\sx|android|(cpu\s|i)os|blackberry.*?version\/|bb)\s?(?<version>[\d\._]+)/i,
87
+ name: /(?<name>windows(?:\sphone(?:\sos)?)?|macintosh|android|ios|blackberry|linux|ubuntu|x11|bsd)/i,
88
+ version: /(?:windows(?:\sphone(?:\sos)?)?|nt|mac\sos\sx|android|(cpu\s|i)os|blackberry.*?version\/|bb)\s?(?<version>[\d\._]+)/i,
89
89
  architecture: /(?<architecture>((?:x|x86_|amd|wow)64)|i(3|6)86)/i,
90
- mobile: /bolt|nokia|samsung|mobi(?:le)?|android|ip(?:[ao]d|hone)|bb\d+|blackberry|iemobile|fennec|bada|meego|vodafone|t\-mobile|opera\sm(?:ob|in)i/i,
90
+ mobile: /bolt|nokia|samsung|mobi(?:le)?|android|i?p(?:[ao]d|hone)|bb\d+|blackberry|iemobile|fennec|bada|meego|vodafone|t\-mobile|opera\sm(?:ob|in)i/i,
91
91
  locale: /\s(?<locale>\w{2}(?:\-\w{2})?)[;\)]/
92
92
  }
93
93
  }
@@ -1,3 +1,3 @@
1
1
  module Browserino
2
- VERSION = "2.5.1"
2
+ VERSION = "2.5.2"
3
3
  end
data/lib/browserino.rb CHANGED
@@ -5,6 +5,7 @@ require "browserino/maps/bsd"
5
5
  require "browserino/maps/linux"
6
6
  require "browserino/maps/android"
7
7
  require "browserino/maps/windows"
8
+ require "browserino/maps/windows_phone"
8
9
 
9
10
  require "browserino/integrate/rails" if defined?(::Rails)
10
11
 
@@ -41,6 +42,7 @@ module Browserino
41
42
  ua = ua.gsub(/(?:ms)?ie/i, '') if /rv\:/i =~ ua
42
43
  ua = ua.gsub(/linux/i, '') if /android/i =~ ua
43
44
  ua = ua.gsub(/x11/i, '') if /bsd/i =~ ua
45
+ ua = ua.gsub(/windows\snt/i, '') if /windows\sphone/i =~ ua
44
46
  ua
45
47
  end
46
48
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: browserino
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.1
4
+ version: 2.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sidney Liebrand
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-12 00:00:00.000000000 Z
11
+ date: 2016-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -143,6 +143,7 @@ files:
143
143
  - lib/browserino/maps/linux.rb
144
144
  - lib/browserino/maps/macintosh.rb
145
145
  - lib/browserino/maps/windows.rb
146
+ - lib/browserino/maps/windows_phone.rb
146
147
  - lib/browserino/operating_system.rb
147
148
  - lib/browserino/patterns.rb
148
149
  - lib/browserino/unknown.rb