UrlCategorise 0.0.2 → 0.0.3

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
  SHA256:
3
- metadata.gz: 6fd17f1e01f20ae4e0efa2ce243c6d32fd24f4a184a52530b158a4edf80ffdfd
4
- data.tar.gz: ab9356f712aaf3f7087814cfb3e56cca522a59321bbc5216f141b4b81f1eab71
3
+ metadata.gz: 926043e28097f20035b4dbc943534c63a5c3c0a429745e4bb42e7dd0701295c1
4
+ data.tar.gz: 3ef850d4c43266a6ec15a7653c64b97720efc2e46298ed36be07d48d70ada772
5
5
  SHA512:
6
- metadata.gz: 7f0cadcb9a7254e3d964708ab7b073f2df1f320062f2b7310070381c79bbca0e3d4e6886ecfb29f2a881eb19c779a2a41b6583d2c5787b432eca5d5d63090d50
7
- data.tar.gz: 590195a7abfcb38110f30f83ec0eb4baece4f18d42d4eed1864f468736948887ced5f6ffbe2a78714d928372566793d6dd453653e0b2c2970aa1a628e254c322
6
+ metadata.gz: c6504dd8ec0a5f284bc78dfcbb7e45b9e1752c50f6f32a380c52128c19364b976232bd4af93c943d73f0b7cbb6e2ac3e44574e90a0fde38da87f5585b92fc3c0
7
+ data.tar.gz: c2de16323a1cfa085ac15590f7601b5307cc7c660243f48b6a5db10df25809041b119eb3f48da382effbe120150c2967ae4224213508fca896c45889bad6bce1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- UrlCategorise (0.0.2)
4
+ UrlCategorise (0.0.3)
5
5
  api_pattern (~> 0.0.4)
6
6
 
7
7
  GEM
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
- (size / 1.megabyte).round(2)
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
@@ -1,5 +1,6 @@
1
1
  module UrlCategorise
2
2
  module Constants
3
+ ONE_MEGABYTE = 1048576
3
4
  DEFAULT_HOST_URLS = {
4
5
  abuse: ["https://github.com/blocklistproject/Lists/raw/master/abuse.txt"],
5
6
  adobe: ["https://github.com/blocklistproject/Lists/raw/master/adobe.txt"],
@@ -1,3 +1,3 @@
1
1
  module UrlCategorise
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: UrlCategorise
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - trex22