browser 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/browser.rb +5 -1
- data/lib/browser/version.rb +1 -1
- data/test/browser_spec.rb +8 -0
- data/test/ua.yml +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84af323f06390a6a105eff4988f6f61eb139520a
|
4
|
+
data.tar.gz: 4a0bc068dd755041f5aa64f8fd20baab667d8fee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97d05cf42b15c8e93d81d1d1b3940b04dfa6178b9df3b992fd64d81887e31a256fc56124eed717dfb74c8a63c11683911baf2e21d0d843a686e4ceb0cf38e564
|
7
|
+
data.tar.gz: b5ab3a5f147fd46beafea02aeade8388ef0ee93504a4641cd851cff13f7ef0b2329befcd0faede8a6a1f650c48510a51a7ef8bcc9948f3c2bcf93ce22e4a4506
|
data/lib/browser.rb
CHANGED
@@ -157,7 +157,11 @@ class Browser
|
|
157
157
|
|
158
158
|
# Detect if browser is Safari.
|
159
159
|
def safari?
|
160
|
-
ua =~ /Safari/ && ua !~ /Android|Chrome|CriOS|PhantomJS/
|
160
|
+
(ua =~ /Safari/ || safari_webapp_mode?) && ua !~ /Android|Chrome|CriOS|PhantomJS/
|
161
|
+
end
|
162
|
+
|
163
|
+
def safari_webapp_mode?
|
164
|
+
(ipad? || iphone?) && ua =~ /AppleWebKit/
|
161
165
|
end
|
162
166
|
|
163
167
|
# Detect if browser is Firefox.
|
data/lib/browser/version.rb
CHANGED
data/test/browser_spec.rb
CHANGED
@@ -66,6 +66,14 @@ describe Browser do
|
|
66
66
|
assert_equal "5", @browser.version
|
67
67
|
end
|
68
68
|
|
69
|
+
it "detects safari in webapp mode" do
|
70
|
+
@browser.ua = $ua["SAFARI_IPAD_WEBAPP_MODE"]
|
71
|
+
assert @browser.safari?
|
72
|
+
|
73
|
+
@browser.ua = $ua["SAFARI_IPHONE_WEBAPP_MODE"]
|
74
|
+
assert @browser.safari?
|
75
|
+
end
|
76
|
+
|
69
77
|
it "detects ipod" do
|
70
78
|
@browser.ua = $ua["IPOD"]
|
71
79
|
|
data/test/ua.yml
CHANGED
@@ -63,6 +63,8 @@ PSP: 'Mozilla/4.0 (PSP (PlayStation Portable); 2.00)'
|
|
63
63
|
PSP_VITA: 'Mozilla/5.0 (Playstation Vita 1.61) AppleWebKit/531.22.8 (KHTML, like Gecko) Silk/3.2'
|
64
64
|
QUICKTIME: 'QuickTime/7.6.8 (qtver=7.6.8;os=Windows NT 5.1Service Pack 3)'
|
65
65
|
SAFARI: 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-us) AppleWebKit/533.17.8 (KHTML, like Gecko) Version/5.0.1 Safari/533.17.8'
|
66
|
+
SAFARI_IPAD_WEBAPP_MODE: 'Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405'
|
67
|
+
SAFARI_IPHONE_WEBAPP_MODE: 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.20 (KHTML, like Gecko) Mobile/7B298g'
|
66
68
|
SAMSUNG: 'Mozilla/5.0 (Linux; U; Android 4.0.4; en-us; SAMSUNG-SGH-I497 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30'
|
67
69
|
SAMSUNG_CHROME: 'Mozilla/5.0 (Linux; Android 4.4.2; en-gb; SAMSUNG GT-I9195/I9195XXUCNEA Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36'
|
68
70
|
SCRAPY: 'Scrapy/0.18.4 (+http://scrapy.org)'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: browser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nando Vieira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|