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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bfc27e8105a5347ecc93584d43ec3d2c3b9aaa6f
4
- data.tar.gz: 5ebbcff1ed0d0d615588fccae4fc1236ba49297a
3
+ metadata.gz: 84af323f06390a6a105eff4988f6f61eb139520a
4
+ data.tar.gz: 4a0bc068dd755041f5aa64f8fd20baab667d8fee
5
5
  SHA512:
6
- metadata.gz: ab4a011e7c8bd8205ffbab3f033796eabb795df94fdbd06bea76cfad566ca2fac3a4b940ef24e2b2f2c814f5acb14c59e9d95acca9686a3b354d4bb4e1924a7c
7
- data.tar.gz: 8c2530b6a76757b67cc804d345d580668131844973ce0ca93a1a12b8b5367662d04fa1d1d72ae51bd912d2838a436279283345ab1580dbee4d33c4099effe164
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.
@@ -2,7 +2,7 @@ class Browser
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 7
5
- PATCH = 1
5
+ PATCH = 2
6
6
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
  end
8
8
  end
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.1
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-01 00:00:00.000000000 Z
11
+ date: 2014-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler