lightly 0.1.1 → 0.1.2

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
  SHA1:
3
- metadata.gz: 49e684faad48b523195a4ae035b1ab73266f1d86
4
- data.tar.gz: 7a5b109eb7b8553a0fb0a303868f45cf4c7fecb5
3
+ metadata.gz: 982581d19c53866cdda51c45b86dc1c9cc8bacc1
4
+ data.tar.gz: 58865bd88aa1e8a8b344efdc1f8269e54ecf889a
5
5
  SHA512:
6
- metadata.gz: 9213c70b1e949ff94950384e7539d5f1c6869e5677a09affdbfa6d409ff8b483775c4bcb7230d7a258a1554640bd8e013ee98630485ee278b358c6c1680ad646
7
- data.tar.gz: e369201931051ee110404b3ad87636012aff1665c8ee00c1660a5edd2930a5b9cbf6c0d7e68012d757cabd6fa02eca63747a030baf92c0561e69ffe2f77d52d4
6
+ metadata.gz: 302df3e4afb8f68a26d33f81e0f8f6bd52af2fd52d4ce84f7daa4fa468aabc71f498088762084d64f19585646eeeefc24ea68edb655f934049748c36423dcbb0
7
+ data.tar.gz: 296c6de22c04d8a4fc13e679a6f697912be667691e82e23aeedb3a81319258512201f76d6cac4cf15f2e23427fe4ff6246176bbf6b18ee719cf1df85d97473e4
data/README.md CHANGED
@@ -33,8 +33,9 @@ require 'lightly'
33
33
 
34
34
  lightly = Lightly.new
35
35
 
36
- content = lightly.with 'key' do
36
+ content = lightly.get 'key' do
37
37
  # Heavy operation here
38
+ entire_internet.download
38
39
  end
39
40
  ```
40
41
 
@@ -69,9 +70,10 @@ lightly = Lightly.new
69
70
  lightly.cached? 'example'
70
71
  # => false
71
72
 
72
- content = lightly.with 'example' do
73
+ content = lightly.get 'example' do
73
74
  open('http://example.com').read
74
75
  end
76
+
75
77
  lightly.cached? 'example'
76
78
  # => true
77
79
  ```
@@ -84,16 +86,19 @@ lightly.disable
84
86
  lightly.enabled?
85
87
  # => false
86
88
 
87
- content = lightly.with 'example' do
89
+ content = lightly.get 'example' do
88
90
  open('http://example.com').read
89
91
  end
92
+
90
93
  lightly.cached? 'example'
91
94
  # => false
92
95
 
93
96
  lightly.enable
94
- content = lightly.with 'example' do
97
+
98
+ content = lightly.get 'example' do
95
99
  open('http://example.com').read
96
100
  end
101
+
97
102
  lightly.cached? 'example'
98
103
  # => true
99
104
  ```
@@ -105,20 +110,10 @@ lightly = Lightly.new
105
110
  lightly.flush
106
111
  ```
107
112
 
108
- The `key` method is an alias to `with`, if you prefer a different wording:
109
-
110
- ```ruby
111
- cache = Lightly.new
112
-
113
- content = cache.key 'example' do
114
- # Heavy operation here
115
- end
116
- ```
117
-
118
113
  ---
119
114
 
120
115
  For a similar gem that provides caching specifically for HTTP downloads,
121
116
  see the [WebCache gem][1]
122
117
 
123
118
 
124
- [1]: https://github.com/DannyBen/webcache
119
+ [1]: https://github.com/DannyBen/webcache
@@ -11,14 +11,13 @@ class Lightly
11
11
  @enabled = true
12
12
  end
13
13
 
14
- def with(key, &block)
14
+ def get(key, &block)
15
15
  return load key if cached?(key) && enabled?
16
16
 
17
17
  content = block.call
18
18
  save key, content if enabled?
19
19
  content
20
20
  end
21
- alias_method :key, :with
22
21
 
23
22
  def flush
24
23
  return false if dir == '/' || dir.empty?
@@ -1,3 +1,3 @@
1
1
  class Lightly
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lightly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-25 00:00:00.000000000 Z
11
+ date: 2016-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: runfile
@@ -110,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
110
  version: '0'
111
111
  requirements: []
112
112
  rubyforge_project:
113
- rubygems_version: 2.4.6
113
+ rubygems_version: 2.5.1
114
114
  signing_key:
115
115
  specification_version: 4
116
116
  summary: File cache for performing heavy tasks, lightly.