richurls 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +7 -1
- data/lib/cache.rb +17 -15
- data/lib/richurls.rb +0 -1
- data/richurls.gemspec +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: 93f358614808a5627aaacc247e54591f077a6ab866e6c97018a82a1ad657179a
|
4
|
+
data.tar.gz: 4d9d11c4689d9f3d3e7e78424f34adb472a69b4afd26c6e5dd20c2803963229d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a82b8cd82f64ce437cace564a5bc5fe56347663e750de0d49248eda9eac162237a4ea42bad34fa80e2caaf50551dea40f52fbe3ef1d660f6d44664257668657e
|
7
|
+
data.tar.gz: 8819107b7264449dde5a8575254079eac31a4289aea3460aaca05c618b01da948be98f9b98ff16f171ac09f1af8721841544bae4ceab54fdffd451bcebfbe064
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -30,7 +30,7 @@ RichUrls.enrich('https://wetransfer.com')
|
|
30
30
|
By default caching is turned off. Caching can be enabled by writing a cache wrapper as such:
|
31
31
|
|
32
32
|
```ruby
|
33
|
-
class CustomCache < Cache::Wrapper
|
33
|
+
class CustomCache < RichUrls::Cache::Wrapper
|
34
34
|
def get(key)
|
35
35
|
# Callback for fetching a cache entry
|
36
36
|
end
|
@@ -44,3 +44,9 @@ class CustomCache < Cache::Wrapper
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
```
|
47
|
+
|
48
|
+
Finally you can enable the `CustomCache` by adding:
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
RichUrls.cache = CustomCache
|
52
|
+
```
|
data/lib/cache.rb
CHANGED
@@ -1,23 +1,25 @@
|
|
1
|
-
module
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
module RichUrls
|
2
|
+
module Cache
|
3
|
+
class Wrapper
|
4
|
+
def get(_key)
|
5
|
+
raise NotImplementedError, 'wrapper needs `get` method'
|
6
|
+
end
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
8
|
+
def set(_key, _value, _time)
|
9
|
+
raise NotImplementedError, 'wrapper needs `set` method'
|
10
|
+
end
|
10
11
|
|
11
|
-
|
12
|
-
|
12
|
+
def extend(_key, _time)
|
13
|
+
raise NotImplementedError, 'wrapper needs `extend` method'
|
14
|
+
end
|
13
15
|
end
|
14
|
-
end
|
15
16
|
|
16
|
-
|
17
|
-
|
17
|
+
class None < Wrapper
|
18
|
+
def get(_); end
|
18
19
|
|
19
|
-
|
20
|
+
def set(_, _, _); end
|
20
21
|
|
21
|
-
|
22
|
+
def extend(_); end
|
23
|
+
end
|
22
24
|
end
|
23
25
|
end
|
data/lib/richurls.rb
CHANGED
data/richurls.gemspec
CHANGED