prosopite 1.0.9 → 1.1.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 +24 -2
- data/lib/prosopite/version.rb +1 -1
- data/lib/prosopite.rb +10 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e7209ed5070fd604f22b0e2a6c0256cf3e30bdc9492403f9c427edef00e5a3c
|
4
|
+
data.tar.gz: 75bd921fee0f39354db2fd7a4136f4c32387bd7b2373b5fc34028340105de9e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c393693a5477df4f7e1615c7d67c71cf77b060deb62a8b47e771604b5af5f2a52bcea1639c345173f50d1d11decc263522565cab89a64bea4974a08c6770d8e
|
7
|
+
data.tar.gz: 7eaece0588d418afb0fecc543b697ca3261567d1bed34e549b826800c2861f7be854999accac0b46e96a7bf7a24b00ea5e6485218b566456bfe76bfb7b3b20c6
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -225,11 +225,19 @@ Prosopite.scan
|
|
225
225
|
Prosopite.finish
|
226
226
|
```
|
227
227
|
|
228
|
-
|
228
|
+
In block form the `Prosopite.finish` is called automatically for you at the end of the block:
|
229
229
|
|
230
230
|
```ruby
|
231
231
|
Prosopite.scan do
|
232
|
-
<code to scan>
|
232
|
+
<code to scan>
|
233
|
+
end
|
234
|
+
```
|
235
|
+
|
236
|
+
The result of the code block is also returned by `Prosopite.scan`, so you can wrap calls as follows:
|
237
|
+
|
238
|
+
```ruby
|
239
|
+
my_object = Prosopite.scan do
|
240
|
+
MyObjectFactory.create(params)
|
233
241
|
end
|
234
242
|
```
|
235
243
|
|
@@ -247,6 +255,20 @@ Prosopite.resume
|
|
247
255
|
Prosopite.finish
|
248
256
|
```
|
249
257
|
|
258
|
+
You can also pause items in a block, and the `Prosopite.resume` will be done
|
259
|
+
for you automatically:
|
260
|
+
|
261
|
+
```ruby
|
262
|
+
Prosopite.scan
|
263
|
+
# <code to scan>
|
264
|
+
|
265
|
+
result = Prosopite.pause do
|
266
|
+
# <code that has n+1s>
|
267
|
+
end
|
268
|
+
|
269
|
+
Prosopite.finish
|
270
|
+
```
|
271
|
+
|
250
272
|
An example of when you might use this is if you are [testing Active Jobs inline](https://guides.rubyonrails.org/testing.html#testing-jobs),
|
251
273
|
and don't want to run Prosopite on background job code, just foreground app code. In that case you could write an [Active Job callback](https://edgeguides.rubyonrails.org/active_job_basics.html#callbacks) that pauses the scan while the job is running.
|
252
274
|
|
data/lib/prosopite/version.rb
CHANGED
data/lib/prosopite.rb
CHANGED
@@ -34,8 +34,9 @@ module Prosopite
|
|
34
34
|
|
35
35
|
if block_given?
|
36
36
|
begin
|
37
|
-
yield
|
37
|
+
block_result = yield
|
38
38
|
finish
|
39
|
+
block_result
|
39
40
|
ensure
|
40
41
|
tc[:prosopite_scan] = false
|
41
42
|
end
|
@@ -48,6 +49,14 @@ module Prosopite
|
|
48
49
|
|
49
50
|
def pause
|
50
51
|
tc[:prosopite_scan] = false
|
52
|
+
|
53
|
+
if block_given?
|
54
|
+
begin
|
55
|
+
yield
|
56
|
+
ensure
|
57
|
+
tc[:prosopite_scan] = true
|
58
|
+
end
|
59
|
+
end
|
51
60
|
end
|
52
61
|
|
53
62
|
def resume
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prosopite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mpampis Kostas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|