UrlCategorise 0.0.2 → 0.0.3
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -1
- data/lib/url_categorise/client.rb +4 -2
- data/lib/url_categorise/constants.rb +1 -0
- data/lib/url_categorise/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 926043e28097f20035b4dbc943534c63a5c3c0a429745e4bb42e7dd0701295c1
|
4
|
+
data.tar.gz: 3ef850d4c43266a6ec15a7653c64b97720efc2e46298ed36be07d48d70ada772
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6504dd8ec0a5f284bc78dfcbb7e45b9e1752c50f6f32a380c52128c19364b976232bd4af93c943d73f0b7cbb6e2ac3e44574e90a0fde38da87f5585b92fc3c0
|
7
|
+
data.tar.gz: c2de16323a1cfa085ac15590f7601b5307cc7c660243f48b6a5db10df25809041b119eb3f48da382effbe120150c2967ae4224213508fca896c45889bad6bce1
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -28,8 +28,9 @@ Use at your own risk!
|
|
28
28
|
|
29
29
|
client.count_of_hosts
|
30
30
|
client.count_of_categories
|
31
|
-
client.size_of_data
|
31
|
+
client.size_of_data # In megabytes
|
32
32
|
|
33
|
+
url = "www.google.com"
|
33
34
|
client.categorise(url)
|
34
35
|
|
35
36
|
# Can also initialise the client using a custom dataset
|
@@ -41,10 +41,12 @@ module UrlCategorise
|
|
41
41
|
|
42
42
|
def hash_size_in_mb(hash)
|
43
43
|
size = 0
|
44
|
+
|
44
45
|
hash.each do |key, value|
|
45
46
|
size += value.join.length
|
46
47
|
end
|
47
|
-
|
48
|
+
|
49
|
+
(size / ONE_MEGABYTE).round(2)
|
48
50
|
end
|
49
51
|
|
50
52
|
def fetch_and_build_host_lists
|
@@ -63,7 +65,7 @@ module UrlCategorise
|
|
63
65
|
end
|
64
66
|
|
65
67
|
original_value << extra_category_values
|
66
|
-
@hosts[category] = original_value
|
68
|
+
@hosts[category] = original_value.uniq.compact
|
67
69
|
end
|
68
70
|
|
69
71
|
@hosts
|