asynchronize 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/readme.md +15 -14
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d25d9fc46fcd88c468cb2441bf096e15773103f9ca2ad0d1930bdcc3f4e71b33
4
- data.tar.gz: aab5b2f4c851c924dba5789282b7b575810ff1cf70bed84e5be0b167d8b1e2e5
3
+ metadata.gz: 11cc7febd9684ba1e902d2c9963e900328b490b87a08e388fbd5c83b0437ab80
4
+ data.tar.gz: 5d6b2650850fed537daf10188a5704df84dc9668e1e2e478c6d3f1caa09438e9
5
5
  SHA512:
6
- metadata.gz: 54aed3b7e306361c981dfeb275ca0721ac3e02c9570fe34fdf02affab88c8fbbc1df6f771870bfe64eb9964731ef6842e09c11351236b37680bbb7c34fe119e2
7
- data.tar.gz: ff384dc8ef4a33a885bdd05aaf33e065cbe5093964a05f549db37ddd8d16178dafd22f80f3edd9c41240eb7b634e74ff7cab2c1f46378430cba61d0bfb681214
6
+ metadata.gz: 36d35ae390f52cbb92ef934eae7ef17e859cb4661ecb98fce3cb8a0053b3d676b47a6e661a93a9cd96f18e58f043766b28e28e96bd529eb01fa37a7a9ada32d9
7
+ data.tar.gz: 524b9184cfa62f8b9bf09883b678c84ca3fcd5c12c89ed0aa53c457536385681e64338e06a130b9063ed01bf92aae77fd15734674d1672012d49791963194e48
data/readme.md CHANGED
@@ -28,26 +28,27 @@ end
28
28
  ```
29
29
 
30
30
  Now, to call those methods.
31
- You can pass a block, and access the return value as the block parameter. The
32
- return value from your block will be accessible at `Thread#value` and the return
33
- value from the original function will be accessible via the thread variable
34
- `:return_value`.
35
- ```Ruby
36
- thread = Test.new.my_test do |return_value|
37
- return return_value.length
38
- end
39
- thread.value # > 7
40
- thread[:return_value] # > testing
41
- ```
42
31
 
43
- Or, without a block `Thread#value` and `thread[:return_value]` both reference
44
- the return value of the original function.
32
+ The method's return value can be accessed either with `Thread#value` or through
33
+ the thread param `:return_value` (make sure the thread is finished first!)
45
34
  ```Ruby
46
35
  thread = Test.new.my_test
47
36
  puts thread.value # > testing
48
37
  puts thread[:return_value] # > testing
49
38
  ```
50
39
 
40
+ Or if called with a block, the method's return value will be passed as a
41
+ parameter. In this case, the original function's return value is still
42
+ accessible at `:return_value`, and `Thread#value` contains the value returned
43
+ from the block.
44
+ ```Ruby
45
+ thread = Test.new.my_test do |return_value|
46
+ return_value.length
47
+ end
48
+ puts thread.value # > 7
49
+ puts thread[:return_value] # > testing
50
+ ```
51
+
51
52
  As you can see, it's just a regular thread. Make sure you call either
52
53
  `Thread#value` or`Thread#join` to ensure it completes before your process exits,
53
54
  and to catch any exceptions that may have been thrown!
@@ -113,7 +114,7 @@ use for interacting with threads. This project aims to be a light convenience
113
114
  wrapper around the existing language features. Just define a regular method,
114
115
  then interact with it's result like a regular thread.
115
116
 
116
- ### What versions are supported?
117
+ ### What Ruby versions are supported?
117
118
  Ruby 2.3 and up. Unfortunately, Ruby versions prior to 2.0 do not support
118
119
  `Module#prepend` and are not supported. Ruby versions prior to 2.3 have a bug
119
120
  preventing usage of `super` with `define_method`. I'm unable to find a suitable
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asynchronize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenneth Cochran
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-08 00:00:00.000000000 Z
11
+ date: 2018-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake