future_proof 0.0.4 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/future_proof/exceptionable.rb +2 -2
- data/lib/future_proof/future.rb +2 -2
- data/lib/future_proof/thread_pool.rb +1 -1
- data/lib/future_proof/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96e0314d6035485600efa021de9f27eed0e266c0
|
4
|
+
data.tar.gz: 22a88afa1bee958adab6ea80cc5222fb3961fbfb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8368ae8968c48af887c7a70c9e9dbcfcff4eaef7c3e6dcb0c6a0d0fbaf00ae17dd8fcba2b710e65bb14c3df46c4679b3b0460549ed3b04142361faaad1f520ba
|
7
|
+
data.tar.gz: de7386bf63e0d3321ecbe7de21d3604343037b17b7c32e164ffbdaa6026680ad97c0a815da4e233f6dfea11cac74a96142e01000095c3322881197e5d3d7f5c3
|
data/README.md
CHANGED
@@ -44,9 +44,9 @@ Or install it yourself as:
|
|
44
44
|
|
45
45
|
## Exceptions
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
47
|
+
If exception happens inside a thread it doesn't affect the whole process. Exception is raised when accessing specific value:
|
48
|
+
|
49
|
+
thread_pool.values[3] # => raises exception
|
50
50
|
|
51
51
|
## Contributing
|
52
52
|
|
@@ -1,11 +1,11 @@
|
|
1
1
|
module FutureProof
|
2
2
|
|
3
|
-
# Module +Exceptionable+ provides methods to read values with exceptions
|
3
|
+
# Module +Exceptionable+ provides methods to read values with exceptions.
|
4
4
|
module Exceptionable
|
5
5
|
|
6
6
|
private
|
7
7
|
|
8
|
-
# Returns value or raises exception if its an exception instance
|
8
|
+
# Returns value or raises exception if its an exception instance.
|
9
9
|
def raise_or_value(value)
|
10
10
|
value.is_a?(StandardError) ? raise(value) : value
|
11
11
|
end
|
data/lib/future_proof/future.rb
CHANGED
@@ -34,12 +34,12 @@ module FutureProof
|
|
34
34
|
thread(*args).value
|
35
35
|
end
|
36
36
|
|
37
|
-
# Return true if Future is done working.
|
37
|
+
# Return true if +Future+ is done working.
|
38
38
|
#
|
39
39
|
# @exmaple Get state of +Future+
|
40
40
|
# future.complete?
|
41
41
|
#
|
42
|
-
# @return [true,
|
42
|
+
# @return [true, false] true if +Future+ is done working.
|
43
43
|
def complete?
|
44
44
|
!thread.alive?
|
45
45
|
end
|
@@ -51,7 +51,7 @@ module FutureProof
|
|
51
51
|
@size.times { @queue.push :END_OF_WORK }
|
52
52
|
end
|
53
53
|
|
54
|
-
# Calls #finalize and
|
54
|
+
# Calls #finalize and blocks programm flow until all jobs are processed.
|
55
55
|
def wait
|
56
56
|
finalize
|
57
57
|
@threads.map &:join
|
data/lib/future_proof/version.rb
CHANGED