browserino 2.8.2 → 2.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/CHANGELOG.md +4 -0
- data/README.md +71 -15
- data/grep +0 -0
- data/lib/browserino/agent.rb +32 -16
- data/lib/browserino/console.rb +10 -0
- data/lib/browserino/core/alias.rb +5 -1
- data/lib/browserino/core/helpers.rb +7 -1
- data/lib/browserino/core/patterns.rb +4 -0
- data/lib/browserino/core/questions.rb +41 -14
- data/lib/browserino/version.rb +1 -1
- data/lib/browserino.rb +12 -21
- metadata +22 -20
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NGI4OGE0YjM1MjljZmI0NWRkMzdjODQ4NTQ1MGM1NTg2MjRjZDlmOQ==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4540d5fa26815c5052d272b101023be2fb7d6fd4
|
4
|
+
data.tar.gz: f2e9b88a2952ab2658d30f4857675e21b7a7e9e0
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
MjhjYWJhYmRkYWFkZGRhZDcyMTBiYjhiMjYzMTU2MzAzNTUyMDQ1MjczYTY2
|
11
|
-
MGZmZjU3N2EyYmFhYzdlMzg3ZmI5NjFiYzg5NGEyZDg3YzBjMTM=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MWVlNmZiYThlMGU4MmFmYzNmYzk0YjVkZDM5NDhiYjAzODRkNGIwOWRhYTcy
|
14
|
-
MWQ4OWRjYTU4NWRlYTE0NWVkM2QxZjk5MTdiOWIyMzBmODcxOGJmMWVhNDc4
|
15
|
-
MmVjYWIxZGFhMmM2ZWM1Y2Y0OGE3MmFkOTRiM2RlOGZiZmIwMTc=
|
6
|
+
metadata.gz: cd7cfb069d12464a948d853de5b01f9a0bc82e3b9a7de594699d99281fa3a0f8fe638a57d85ee7f4473b370ebbcb83c4f4bc45bd8f83081103b1fdb582568567
|
7
|
+
data.tar.gz: 82f24724c735848c9d9607ae79db8160ddfe9c3e2cf3fcf03d185f949e63f88f3bc64c396942854fe0fb82698de80ae17eabd7a203549b2db6b16aa3cbbd183c
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -21,6 +21,25 @@ Useragent references:
|
|
21
21
|
_dates are in dd-mm-yyyy format_
|
22
22
|
_older changes can be found in the [CHANGELOG.md](/CHANGELOG.md)_
|
23
23
|
|
24
|
+
#### 29-05-2016 VERSION 2.9.0
|
25
|
+
|
26
|
+
- Stricter checking for:
|
27
|
+
* `social_media?`
|
28
|
+
* `bot?`
|
29
|
+
* `browser?`
|
30
|
+
* `platform?`
|
31
|
+
|
32
|
+
These functions used to be callable with unrelated symbols
|
33
|
+
(e.g `agent.platform?(:firefox) # => true`). This is now also filtered.
|
34
|
+
- Added support for consoles
|
35
|
+
* Added `console?` method
|
36
|
+
* Added `wii?`, `playstation?`, `xbox?` and `nintendo_ds?` methods
|
37
|
+
- Added general `name` method to store any browser / bot / search engine / social media agent
|
38
|
+
- `social_media_name`, `search_engine_name` and `bot_name` are now aliasses of `name`
|
39
|
+
- removed `:bot_name` from data structure (now stored in a general `name` property)
|
40
|
+
- removed `:browser_name` from data structure (now stored in a general `name` property)
|
41
|
+
- Added `console_name` method to get the name of a console
|
42
|
+
|
24
43
|
#### 27-05-2016 VERSION 2.8.2
|
25
44
|
|
26
45
|
- Removed Guard gem dependency
|
@@ -34,10 +53,6 @@ _older changes can be found in the [CHANGELOG.md](/CHANGELOG.md)_
|
|
34
53
|
- Fixed `respond_to?` method signature
|
35
54
|
- Added executable for parsing useragents in terminal
|
36
55
|
|
37
|
-
#### 02-03-2016 VERSION 2.7.0
|
38
|
-
|
39
|
-
- Added `solaris?` method
|
40
|
-
|
41
56
|
## Installation
|
42
57
|
|
43
58
|
Add the following to your applications Gemfile:
|
@@ -87,7 +102,7 @@ Browserino is also usable in the command line
|
|
87
102
|
|
88
103
|
Output
|
89
104
|
```
|
90
|
-
|
105
|
+
name: chrome, browser_version: 50.0.2661.102, engine_name: webkit, engine_version: 537.36, system_name: macintosh, system_architecture: nil
|
91
106
|
```
|
92
107
|
|
93
108
|
### Rails (>= 3.2.0)
|
@@ -118,7 +133,7 @@ If a property isn't available or not known to Browserino it's return value will
|
|
118
133
|
|
119
134
|
```ruby
|
120
135
|
agent = Browserino.parse ''
|
121
|
-
agent.
|
136
|
+
agent.name
|
122
137
|
# => nil
|
123
138
|
```
|
124
139
|
|
@@ -127,6 +142,11 @@ If a value *is* found then you'll recieve a *lowercase string* containing the in
|
|
127
142
|
```ruby
|
128
143
|
agent = Browserino.parse 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) brave/0.7.7 Chrome/47.0.2526.73 Electron/0.36.2 Safari/537.36'
|
129
144
|
|
145
|
+
agent.name
|
146
|
+
# => 'brave'
|
147
|
+
|
148
|
+
# or using browser_name
|
149
|
+
|
130
150
|
agent.browser_name
|
131
151
|
# => 'brave'
|
132
152
|
|
@@ -162,10 +182,17 @@ The samples below are all valid calls with their respective outputs, using the `
|
|
162
182
|
agent = Browserino.parse 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko'
|
163
183
|
```
|
164
184
|
|
185
|
+
#### Note
|
186
|
+
|
187
|
+
The methods `social_media_name`, `search_engine_name`, `bot_name` and `browser_name`
|
188
|
+
are *all* aliasses of the general `name` method.
|
189
|
+
|
190
|
+
The exceptions to this rule are `system_name` and `console_name`. They each have their own method.
|
191
|
+
|
165
192
|
##### Quick usage
|
166
193
|
|
167
194
|
```ruby
|
168
|
-
agent.
|
195
|
+
agent.name
|
169
196
|
# => 'ie'
|
170
197
|
|
171
198
|
# always returns real version, also when IE is in compat
|
@@ -198,6 +225,9 @@ agent.system_version
|
|
198
225
|
agent.system_architecture
|
199
226
|
# => 'x64'
|
200
227
|
|
228
|
+
agent.console_name
|
229
|
+
# => nil
|
230
|
+
|
201
231
|
# two formats possible: 'aa' or `aa-bb`
|
202
232
|
agent.locale
|
203
233
|
# => 'as'
|
@@ -212,7 +242,7 @@ Browserino also provides some question methods.
|
|
212
242
|
agent.compat?
|
213
243
|
# => false
|
214
244
|
|
215
|
-
# returns true if
|
245
|
+
# returns true if name is present
|
216
246
|
agent.known?
|
217
247
|
# => true
|
218
248
|
|
@@ -243,6 +273,14 @@ agent.platform? :windows
|
|
243
273
|
agent.platform? :windows, version: '7'
|
244
274
|
# => true
|
245
275
|
|
276
|
+
# returns true if console is known
|
277
|
+
agent.console?
|
278
|
+
# => false
|
279
|
+
|
280
|
+
# returns true if specific console
|
281
|
+
agent.console? :xbox
|
282
|
+
# => false
|
283
|
+
|
246
284
|
# returns true if user agent is empty or a bot is recognized
|
247
285
|
agent.bot?
|
248
286
|
# => false
|
@@ -303,15 +341,15 @@ Returns an array with key => value pairs.
|
|
303
341
|
|
304
342
|
```ruby
|
305
343
|
agent.to_a
|
306
|
-
# => [[:
|
344
|
+
# => [[:name, "ie"],
|
307
345
|
# [:browser_version, "11.0"],
|
308
346
|
# [:engine_name, "trident"],
|
309
347
|
# [:engine_version, "7.0"],
|
310
348
|
# [:system_name, "windows"],
|
311
349
|
# [:system_version, "6.1"],
|
312
350
|
# [:system_architecture, "x64"],
|
313
|
-
# [:
|
314
|
-
# [:
|
351
|
+
# [:console_name, nil],
|
352
|
+
# [:locale, "as"]]
|
315
353
|
```
|
316
354
|
|
317
355
|
**to_h**
|
@@ -320,15 +358,15 @@ Returns a hash with key => value pairs.
|
|
320
358
|
|
321
359
|
```ruby
|
322
360
|
agent.to_h
|
323
|
-
# => {:
|
361
|
+
# => {:name=>"ie",
|
324
362
|
# :browser_version=>"11.0",
|
325
363
|
# :engine_name=>"trident",
|
326
364
|
# :engine_version=>"7.0",
|
327
365
|
# :system_name=>"windows",
|
328
366
|
# :system_version=>"6.1",
|
329
367
|
# :system_architecture=>"x64",
|
330
|
-
# :
|
331
|
-
# :
|
368
|
+
# :console_name => nil,
|
369
|
+
# :locale=>"as"}
|
332
370
|
```
|
333
371
|
|
334
372
|
##### Supplying versions
|
@@ -382,7 +420,7 @@ agent.platform? :android, version: :jelly_bean_16
|
|
382
420
|
# => true
|
383
421
|
```
|
384
422
|
|
385
|
-
##### `platform?`, `browser?`, `bot
|
423
|
+
##### `platform?`, `browser?`, `bot?`, `console?`, `search_engine?` and `social_media?` methods
|
386
424
|
|
387
425
|
As you've seen above, the `platform?` function can take two arguments, a symbol with the system name and optionally a hash with a `:version` key to supply a version, the `browser?` method works in exactly the same way.
|
388
426
|
|
@@ -434,6 +472,24 @@ agent.search_engine? :google
|
|
434
472
|
agent.search_engine? :ddg
|
435
473
|
```
|
436
474
|
|
475
|
+
**consoles**
|
476
|
+
|
477
|
+
* `xbox`
|
478
|
+
* `nintendo_ds`
|
479
|
+
* `wii`
|
480
|
+
* `playstation`
|
481
|
+
|
482
|
+
Examples:
|
483
|
+
|
484
|
+
```ruby
|
485
|
+
agent.playstation?
|
486
|
+
agent.wii?
|
487
|
+
|
488
|
+
agent.console?
|
489
|
+
|
490
|
+
agent.console? :facebook
|
491
|
+
```
|
492
|
+
|
437
493
|
**social media**
|
438
494
|
|
439
495
|
* `facebook` or `fb`
|
data/grep
ADDED
File without changes
|
data/lib/browserino/agent.rb
CHANGED
@@ -6,13 +6,18 @@ module Browserino
|
|
6
6
|
def initialize(info, ua = nil)
|
7
7
|
@ua = ua
|
8
8
|
@not = false
|
9
|
-
@info = info
|
9
|
+
@info = post_process(info)
|
10
10
|
end
|
11
11
|
|
12
|
-
def
|
13
|
-
@info[:
|
12
|
+
def name
|
13
|
+
@info[:name]
|
14
14
|
end
|
15
15
|
|
16
|
+
alias_method :browser_name, :name
|
17
|
+
alias_method :bot_name, :name
|
18
|
+
alias_method :search_engine_name, :name
|
19
|
+
alias_method :social_media_name, :name
|
20
|
+
|
16
21
|
def browser_version(opts = {})
|
17
22
|
if ie? && engine_version && !opts[:compat]
|
18
23
|
(engine_version.to_f + 4.0).to_s
|
@@ -31,7 +36,8 @@ module Browserino
|
|
31
36
|
|
32
37
|
def system_name(opts = {})
|
33
38
|
if opts[:full]
|
34
|
-
[@info[:system_name],
|
39
|
+
@full_sys_name ||= [@info[:system_name],
|
40
|
+
fetch_system_version_name(@info[:system_name])]
|
35
41
|
else
|
36
42
|
@info[:system_name]
|
37
43
|
end
|
@@ -45,16 +51,12 @@ module Browserino
|
|
45
51
|
@info[:system_architecture]
|
46
52
|
end
|
47
53
|
|
48
|
-
def
|
49
|
-
@info[:
|
50
|
-
end
|
51
|
-
|
52
|
-
def bot_name
|
53
|
-
@info[:bot_name]
|
54
|
+
def console_name
|
55
|
+
@info[:console_name]
|
54
56
|
end
|
55
57
|
|
56
|
-
def
|
57
|
-
@info[:
|
58
|
+
def locale
|
59
|
+
@info[:locale]
|
58
60
|
end
|
59
61
|
|
60
62
|
def not
|
@@ -79,7 +81,7 @@ module Browserino
|
|
79
81
|
end
|
80
82
|
prev = v[1]
|
81
83
|
end
|
82
|
-
s.reject { |str| str == '' }.join ' '
|
84
|
+
s.uniq.reject { |str| str == '' }.join ' '
|
83
85
|
end
|
84
86
|
|
85
87
|
def hash_for_to_s
|
@@ -91,7 +93,7 @@ module Browserino
|
|
91
93
|
end
|
92
94
|
|
93
95
|
def to_a
|
94
|
-
@info.keys.each_with_object([]) { |f, a| a.push([f, send(f)]) }
|
96
|
+
@info.keys.each_with_object([]) { |f, a| a.push([f, send(f)]) }
|
95
97
|
end
|
96
98
|
|
97
99
|
def to_h
|
@@ -100,15 +102,29 @@ module Browserino
|
|
100
102
|
|
101
103
|
def method_missing(method_sym, *args, &block)
|
102
104
|
name = method_sym.to_s.tr('?', '')
|
103
|
-
invertable case
|
105
|
+
invertable case type_id(method_sym)
|
104
106
|
when :system then correct_system?(name, *args)
|
105
107
|
when :agent then correct_agent?(name, *args)
|
108
|
+
when :console then correct_console?(name, *args)
|
106
109
|
else super
|
107
110
|
end
|
108
111
|
end
|
109
112
|
|
110
113
|
def respond_to?(method_sym, *args, &block)
|
111
|
-
|
114
|
+
type_id(method_sym).nil? ? false : true
|
115
|
+
end
|
116
|
+
|
117
|
+
private
|
118
|
+
|
119
|
+
def post_process(h)
|
120
|
+
case h[:name]
|
121
|
+
when 'edge'
|
122
|
+
h[:engine_name] = 'edgehtml'
|
123
|
+
h[:engine_version] = h[:browser_version].to_s.split('.').shift.to_s
|
124
|
+
when 'ie'
|
125
|
+
h[:engine_name] = 'trident'
|
126
|
+
end
|
127
|
+
h
|
112
128
|
end
|
113
129
|
end
|
114
130
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Browserino
|
2
2
|
module Core
|
3
3
|
ALIAS = {
|
4
|
-
|
4
|
+
name: { 'ie' => /msie/ },
|
5
5
|
engine_name: { 'webkit' => /applewebkit/ },
|
6
6
|
system_name: {
|
7
7
|
'solaris' => /s(?:unos|olaris)/,
|
@@ -9,6 +9,10 @@ module Browserino
|
|
9
9
|
'windows_phone' => /windows\sphone/,
|
10
10
|
'ios' => /ip(?:[ao]d|hone)/
|
11
11
|
},
|
12
|
+
console_name: {
|
13
|
+
'nintendo_ds' => /nintendo\s\d?ds/,
|
14
|
+
'wii' => /wiiu?/
|
15
|
+
},
|
12
16
|
system_architecture: {
|
13
17
|
'x64' => /(?:x86_|amd|wow)?64/,
|
14
18
|
'x32' => /(?:(?:x86_)?32|i[36]8[36])/
|
@@ -45,13 +45,19 @@ module Browserino
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
def
|
48
|
+
def correct_console?(name)
|
49
|
+
Core::Questions::CONSOLES.include?(name.to_sym)
|
50
|
+
end
|
51
|
+
|
52
|
+
def type_id(method_sym)
|
49
53
|
name = method_sym.to_s.tr('?', '')
|
50
54
|
supported = Core::PATTERNS[:browser].merge(Core::PATTERNS[:bot]).keys
|
51
55
|
if supported.include?(name.to_sym)
|
52
56
|
:agent
|
53
57
|
elsif Mapping.const?(name.upcase.to_sym)
|
54
58
|
:system
|
59
|
+
elsif name == 'console'
|
60
|
+
:console
|
55
61
|
end
|
56
62
|
end
|
57
63
|
|
@@ -113,6 +113,10 @@ module Browserino
|
|
113
113
|
|blackberry|iemobile|fennec|bada|meego|vodafone
|
114
114
|
|t\-mobile|opera\sm(?:ob|in)i/xi,
|
115
115
|
locale: /\s(?<locale>\w{2}(?:\-\w{2})?)[;\)]/
|
116
|
+
},
|
117
|
+
|
118
|
+
console: {
|
119
|
+
name: /(?<name>xbox|playstation|nintendo\s3?ds|wiiu?)/i,
|
116
120
|
}
|
117
121
|
}.freeze
|
118
122
|
end
|
@@ -1,11 +1,19 @@
|
|
1
1
|
module Browserino
|
2
2
|
module Core
|
3
3
|
module Questions
|
4
|
-
SOCIAL_MEDIA = [:facebook, :twitter, :linkedin,
|
4
|
+
SOCIAL_MEDIA = [:facebook, :fb, :twitter, :linkedin,
|
5
5
|
:instagram, :pinterest, :tumblr].freeze
|
6
6
|
|
7
7
|
SEARCH_ENGINES = [:google, :bing, :yahoo_slurp,
|
8
|
-
:baiduspider, :duckduckgo].freeze
|
8
|
+
:baiduspider, :duckduckgo, :ddg].freeze
|
9
|
+
|
10
|
+
BROWSERS = (Core::PATTERNS[:browser].keys + [:ff]).freeze
|
11
|
+
|
12
|
+
CONSOLES = [:xbox, :playstation, :nintendo_ds, :wii].freeze
|
13
|
+
|
14
|
+
OPERATING_SYSTEMS = (Browserino::Mapping
|
15
|
+
.constants(:true)
|
16
|
+
.map(&:downcase) + [:osx, :bb, :win]).freeze
|
9
17
|
|
10
18
|
def compat?
|
11
19
|
invertable ie? && browser_version != browser_version(compat: true)
|
@@ -51,34 +59,53 @@ module Browserino
|
|
51
59
|
duckduckgo?(*arg)
|
52
60
|
end
|
53
61
|
|
62
|
+
def playstation?
|
63
|
+
invertable console_name == 'playstation'
|
64
|
+
end
|
65
|
+
|
66
|
+
def nintendo_ds?
|
67
|
+
invertable console_name == 'nintendo_ds'
|
68
|
+
end
|
69
|
+
|
70
|
+
def xbox?
|
71
|
+
invertable console_name == 'xbox'
|
72
|
+
end
|
73
|
+
|
74
|
+
def wii?
|
75
|
+
invertable console_name == 'wii'
|
76
|
+
end
|
77
|
+
|
54
78
|
def bot?(name = nil)
|
55
79
|
is_bot = ua.strip.empty? || !bot_name.nil?
|
56
80
|
is_name = name.nil? || name.to_s.downcase.tr('_', ' ') == bot_name
|
57
81
|
invertable is_bot && is_name
|
58
82
|
end
|
59
83
|
|
84
|
+
def console?(name = nil)
|
85
|
+
arg = (name.nil? ? console_name : name).to_s.to_sym
|
86
|
+
invertable CONSOLES.include?(arg)
|
87
|
+
end
|
88
|
+
|
60
89
|
def search_engine?(name = nil)
|
61
|
-
|
62
|
-
|
63
|
-
else
|
64
|
-
invertable SEARCH_ENGINES.include?(search_engine_name.to_s.to_sym)
|
65
|
-
end
|
90
|
+
arg = (name.nil? ? search_engine_name : name).to_s.to_sym
|
91
|
+
invertable SEARCH_ENGINES.include?(arg)
|
66
92
|
end
|
67
93
|
|
68
94
|
def social_media?(name = nil)
|
69
|
-
|
70
|
-
|
71
|
-
else
|
72
|
-
invertable SOCIAL_MEDIA.include?(bot_name.to_s.to_sym)
|
73
|
-
end
|
95
|
+
arg = (name.nil? ? bot_name : name).to_s.to_sym
|
96
|
+
invertable SOCIAL_MEDIA.include?(arg.to_s.to_sym)
|
74
97
|
end
|
75
98
|
|
76
99
|
def platform?(name = nil, opts = {})
|
77
|
-
|
100
|
+
arg = (name.nil? ? system_name : name).to_s.to_sym
|
101
|
+
invertable OPERATING_SYSTEMS.include?(arg) &&
|
102
|
+
(opts[:version].nil? ? true : send("#{name}?", opts[:version]))
|
78
103
|
end
|
79
104
|
|
80
105
|
def browser?(name = nil, opts = {})
|
81
|
-
|
106
|
+
arg = (name.nil? ? browser_name.tr(' ', '_') : name).to_s.to_sym
|
107
|
+
invertable BROWSERS.include?(arg) &&
|
108
|
+
(opts[:version].nil? ? true : send("#{name}?", opts[:version]))
|
82
109
|
end
|
83
110
|
end
|
84
111
|
end
|
data/lib/browserino/version.rb
CHANGED
data/lib/browserino.rb
CHANGED
@@ -1,9 +1,3 @@
|
|
1
|
-
require 'browserino/core/helpers'
|
2
|
-
require 'browserino/core/questions'
|
3
|
-
require 'browserino/core/lies'
|
4
|
-
require 'browserino/core/alias'
|
5
|
-
require 'browserino/core/patterns'
|
6
|
-
|
7
1
|
require 'browserino/maps/mapping'
|
8
2
|
require 'browserino/maps/macintosh'
|
9
3
|
require 'browserino/maps/blackberry'
|
@@ -15,6 +9,12 @@ require 'browserino/maps/android'
|
|
15
9
|
require 'browserino/maps/windows'
|
16
10
|
require 'browserino/maps/windows_phone'
|
17
11
|
|
12
|
+
require 'browserino/core/patterns'
|
13
|
+
require 'browserino/core/questions'
|
14
|
+
require 'browserino/core/helpers'
|
15
|
+
require 'browserino/core/lies'
|
16
|
+
require 'browserino/core/alias'
|
17
|
+
|
18
18
|
require 'browserino/integrate/rails' if defined?(::Rails)
|
19
19
|
|
20
20
|
require 'browserino/unknown'
|
@@ -24,6 +24,7 @@ require 'browserino/version'
|
|
24
24
|
require 'browserino/browser'
|
25
25
|
require 'browserino/engine'
|
26
26
|
require 'browserino/operating_system'
|
27
|
+
require 'browserino/console'
|
27
28
|
|
28
29
|
# require_relative "../spec/user_agents"
|
29
30
|
# require_relative "../spec/user_agents_bots"
|
@@ -35,32 +36,22 @@ module Browserino
|
|
35
36
|
def parse(ua, _ = nil) # _ = nil maintains backwards compatibility
|
36
37
|
name = Browser.name(ua)
|
37
38
|
info = fetch_info(strip_lies(ua), name)
|
38
|
-
tmp = info[:
|
39
|
-
info[:
|
40
|
-
info = check_if_bot(name, info)
|
39
|
+
tmp = info[:name].to_s.tr('_', ' ')
|
40
|
+
info[:name] = tmp.strip == '' ? nil : tmp
|
41
41
|
|
42
42
|
Agent.new check_for_aliases(info), ua
|
43
43
|
end
|
44
44
|
|
45
45
|
def fetch_info(ua, name)
|
46
|
-
{
|
46
|
+
{ name: name,
|
47
47
|
browser_version: Browser.version(ua, Core::PATTERNS[:browser][name]),
|
48
48
|
engine_name: Engine.name(ua),
|
49
49
|
engine_version: Engine.version(ua),
|
50
50
|
system_name: OperatingSystem.name(ua),
|
51
51
|
system_version: OperatingSystem.version(ua),
|
52
52
|
system_architecture: OperatingSystem.architecture(ua),
|
53
|
-
|
54
|
-
|
55
|
-
end
|
56
|
-
|
57
|
-
def check_if_bot(name, info)
|
58
|
-
if Core::PATTERNS[:bot].include?(name)
|
59
|
-
info[:bot_name] = info[:browser_name]
|
60
|
-
info[:browser_name] = nil
|
61
|
-
info[:browser_version] = nil
|
62
|
-
end
|
63
|
-
info
|
53
|
+
console_name: Console.name(ua),
|
54
|
+
locale: OperatingSystem.locale(ua) }
|
64
55
|
end
|
65
56
|
|
66
57
|
def strip_lies(ua)
|
metadata
CHANGED
@@ -1,83 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: browserino
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sidney Liebrand
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.10'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.10'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '10.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: coveralls
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: pry
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
description:
|
@@ -88,11 +88,11 @@ executables:
|
|
88
88
|
extensions: []
|
89
89
|
extra_rdoc_files: []
|
90
90
|
files:
|
91
|
-
- .coveralls.yml
|
92
|
-
- .gitignore
|
93
|
-
- .rspec
|
94
|
-
- .rubocop.yml
|
95
|
-
- .travis.yml
|
91
|
+
- ".coveralls.yml"
|
92
|
+
- ".gitignore"
|
93
|
+
- ".rspec"
|
94
|
+
- ".rubocop.yml"
|
95
|
+
- ".travis.yml"
|
96
96
|
- CHANGELOG.md
|
97
97
|
- CODE_OF_CONDUCT.md
|
98
98
|
- Gemfile
|
@@ -103,9 +103,11 @@ files:
|
|
103
103
|
- bin/console
|
104
104
|
- bin/setup
|
105
105
|
- browserino.gemspec
|
106
|
+
- grep
|
106
107
|
- lib/browserino.rb
|
107
108
|
- lib/browserino/agent.rb
|
108
109
|
- lib/browserino/browser.rb
|
110
|
+
- lib/browserino/console.rb
|
109
111
|
- lib/browserino/core/alias.rb
|
110
112
|
- lib/browserino/core/helpers.rb
|
111
113
|
- lib/browserino/core/lies.rb
|
@@ -137,17 +139,17 @@ require_paths:
|
|
137
139
|
- lib
|
138
140
|
required_ruby_version: !ruby/object:Gem::Requirement
|
139
141
|
requirements:
|
140
|
-
- -
|
142
|
+
- - ">="
|
141
143
|
- !ruby/object:Gem::Version
|
142
144
|
version: '0'
|
143
145
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
146
|
requirements:
|
145
|
-
- -
|
147
|
+
- - ">="
|
146
148
|
- !ruby/object:Gem::Version
|
147
149
|
version: '0'
|
148
150
|
requirements: []
|
149
151
|
rubyforge_project:
|
150
|
-
rubygems_version: 2.
|
152
|
+
rubygems_version: 2.5.1
|
151
153
|
signing_key:
|
152
154
|
specification_version: 4
|
153
155
|
summary: A browser identification gem with Rails (>= 3.2.0) integration
|