team_effort 1.1.0 → 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/README.md +19 -0
- data/lib/team_effort/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: d5dd797a1ea8ba584a6996ed284b6183029dc606ea72ec52b40fed097dd334d1
|
4
|
+
data.tar.gz: cd339ee81904aa3363ed327eb5d0744d77320387ee56f810e9d11b4f06a08e1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c438a4fcc22b383dc89581b36c9bf3aa8b33ccf241b88511b18d09347f6a7dfac3e68a2fedd6cafc1d6d504089b87da7682ed6e92982595edf1bac40838eaa4f
|
7
|
+
data.tar.gz: d97a2620da7bf4230d6710ab9108547e4c684eec5507ce16add664a4eb76185cf4a472234cc1d0eecb16d0acd4312270cf5f10ed521e02404654ede40e9f9e04
|
data/README.md
CHANGED
@@ -64,6 +64,25 @@ You can pass in a proc to receive completion notifications.
|
|
64
64
|
100%
|
65
65
|
```
|
66
66
|
|
67
|
+
Your proc can return a result that will be provided the next time the proc is called.
|
68
|
+
|
69
|
+
```irb
|
70
|
+
> data = 1..1_000
|
71
|
+
> progress_proc = ->(index, max_index, previous_percent_complete) {
|
72
|
+
> percent_complete = sprintf("%3i%", index.to_f / max_index * 100)
|
73
|
+
> if percent_complete != previous_percent_complete # Only print when the percent complete changes
|
74
|
+
> puts "#{ percent_complete }"
|
75
|
+
> end
|
76
|
+
> percent_complete
|
77
|
+
> }
|
78
|
+
> TeamEffort.work(data, progress_proc: progress_proc) {}
|
79
|
+
0%
|
80
|
+
1%
|
81
|
+
2%
|
82
|
+
3%
|
83
|
+
...
|
84
|
+
```
|
85
|
+
|
67
86
|
In rails you need to reestablish your ActiveRecord connection in the
|
68
87
|
child process:
|
69
88
|
|
data/lib/team_effort/version.rb
CHANGED