useragent2css 1.1 → 1.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.
- data/lib/useragent2css/version.rb +1 -1
- data/lib/useragent2css.rb +1 -0
- data/spec/useragent2css_spec.rb +8 -3
- metadata +24 -9
data/lib/useragent2css.rb
CHANGED
@@ -29,6 +29,7 @@ module UserAgent
|
|
29
29
|
o.join(" ")
|
30
30
|
when /gecko/, /mozilla/ ; "gecko"
|
31
31
|
end
|
32
|
+
br = (br.nil? ? "mobile" : "#{br} mobile") if ua.include?('mobile')
|
32
33
|
os = ua.include?('mac') || ua.include?('darwin') ?
|
33
34
|
ua.include?('iphone') ? 'iphone' : ua.include?('ipod') ? 'ipod' : ua.include?('ipad') ? 'ipad' : 'mac' :
|
34
35
|
ua.include?('x11') || ua.include?('linux') ? 'linux' :
|
data/spec/useragent2css_spec.rb
CHANGED
@@ -16,6 +16,11 @@ describe UserAgent do
|
|
16
16
|
UserAgent.css("").should == ""
|
17
17
|
end
|
18
18
|
|
19
|
+
it "mobile" do
|
20
|
+
UserAgent.css("Mozilla/5.0(iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10").should == "webkit safari safari4 mobile iphone"
|
21
|
+
UserAgent.css("Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.5; Trident/3.1; IEMobile/7.0;").should == "ie ie7 mobile win"
|
22
|
+
end
|
23
|
+
|
19
24
|
it "iron" do
|
20
25
|
UserAgent.css("mozilla/5.0 (windows; u; windows nt 5.1; en-us) applewebkit/530.1 (khtml, like gecko) iron/2.0.168.0 safari/530.1").should == "webkit iron win"
|
21
26
|
end
|
@@ -179,9 +184,9 @@ describe UserAgent do
|
|
179
184
|
assert_browser_strings({
|
180
185
|
"mozilla/5.0 (windows; u; windows nt 6.0; pt-br) applewebkit/528.16 (khtml, like gecko) version/4.0 safari/528.16" => "webkit safari safari4 win",
|
181
186
|
"Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-gb) AppleWebKit/523.10.6 (KHTML, like Gecko) Version/3.0.4 Safari/523.10.6" => "webkit safari safari3 mac", # Safari 3.0.4 on Mac OS 10.5.1 Intel
|
182
|
-
"Mozilla/5.0 (iPod; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3A100a Safari/419.3" => "webkit safari safari3 ipod", # Safari 3.0 for the iPod touch
|
183
|
-
"Mozilla/5.0 (iPad; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3A100a Safari/419.3" => "webkit safari safari3 ipad", # Safari 3.0 for the iPad
|
184
|
-
"Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1C28 Safari/419.3" => "webkit safari safari3 iphone", # Safari 3.0 for the iPhone
|
187
|
+
"Mozilla/5.0 (iPod; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3A100a Safari/419.3" => "webkit safari safari3 mobile ipod", # Safari 3.0 for the iPod touch
|
188
|
+
"Mozilla/5.0 (iPad; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3A100a Safari/419.3" => "webkit safari safari3 mobile ipad", # Safari 3.0 for the iPad
|
189
|
+
"Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1C28 Safari/419.3" => "webkit safari safari3 mobile iphone", # Safari 3.0 for the iPhone
|
185
190
|
"Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/522.11.1 (KHTML, like Gecko) Version/3.0.3 Safari/522.12.1" => "webkit safari safari3 mac", # Safari 3.0.3 for Intel version of iMac
|
186
191
|
"Mozilla/5.0 (Windows; U; Windows NT 5.1; bg) AppleWebKit/522.13.1 (KHTML, like Gecko) Version/3.0.2 Safari/522.13.1" => "webkit safari safari3 win", # Safari 3.0.2 beta for Windows XP
|
187
192
|
"Mozilla/5.0 (Windows; U; Windows NT 5.1; ru) AppleWebKit/522.11.3 (KHTML, like Gecko) Version/3.0 Safari/522.11.3" => "webkit safari safari3 win", # Safari browser V 3.0 Beta for Windows XP SP2
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: useragent2css
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.2'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-05-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: rake
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: rspec
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ! '>='
|
@@ -43,7 +53,12 @@ dependencies:
|
|
43
53
|
version: '0'
|
44
54
|
type: :development
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
47
62
|
description: User-Agent to CSS parser for ruby
|
48
63
|
email: lawrence.pit@gmail.com
|
49
64
|
executables: []
|
@@ -79,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
94
|
version: '0'
|
80
95
|
requirements: []
|
81
96
|
rubyforge_project:
|
82
|
-
rubygems_version: 1.8.
|
97
|
+
rubygems_version: 1.8.21
|
83
98
|
signing_key:
|
84
99
|
specification_version: 3
|
85
100
|
summary: User-Agent to CSS parser for ruby
|