user_agent_list 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/user_agent_list.rb +2 -0
- data/lib/user_agent_list/parser_ua.rb +4 -3
- data/lib/user_agent_list/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1dfe3baa0c5c0d72c8ead7a355a1980eda050301
|
4
|
+
data.tar.gz: 5b677d1b1cd9f1c2f94f661d9f92ef56b6642157
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 905a41575649a47c56f3634a56e9d6079dc8c53edd1dc9d0a940527d2386e5196f062ac337bd514ba0796cfebc1e159155af2e7b79f423c4f01837e5d1c5ef59
|
7
|
+
data.tar.gz: c1f50f2e7ec475733d66b83bb22f86a397f27640a8b824d3bf01a2d6b3597087e65d7351cfacead623343ae6c4ddc491dd4a46c183e46bcd61cba5cd888e6168
|
data/lib/user_agent_list.rb
CHANGED
@@ -4,9 +4,10 @@ module UserAgentList
|
|
4
4
|
result = {}
|
5
5
|
parser.css('h3').each do |item|
|
6
6
|
parser.css("a:contains('#{item.text}')").each do |link|
|
7
|
-
result[item] ||= []
|
8
|
-
result[item] << link.children.text
|
7
|
+
result[item.text] ||= []
|
8
|
+
result[item.text] << link.children.text unless link.children.text =~ /-->>/
|
9
9
|
end
|
10
|
+
result.delete(item.text) if result[item.text] && result[item.text].empty?
|
10
11
|
end
|
11
12
|
result
|
12
13
|
end
|
@@ -16,7 +17,7 @@ module UserAgentList
|
|
16
17
|
|
17
18
|
result = []
|
18
19
|
parser.css("a:contains('#{string}')").each do |link|
|
19
|
-
result << link.children.text
|
20
|
+
result << link.children.text unless link.children.text =~ /-->>/
|
20
21
|
end
|
21
22
|
result
|
22
23
|
end
|