ifuture 0.0.4 → 0.0.5
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.
- data/.travis.yml +4 -0
- data/README.md +3 -2
- data/Rakefile +5 -0
- data/ifuture.gemspec +3 -0
- data/lib/ifuture/version.rb +1 -1
- data/test/helper.rb +3 -0
- data/test/ichannel_test.rb +39 -0
- metadata +38 -2
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# ifuture
|
2
|
+
[](http://travis-ci.org/Havenwood/ifuture)
|
2
3
|
|
3
|
-
An implementation of Futures for Ruby using process forks with IChannel.
|
4
|
+
An implementation of Futures for Ruby using process forks with [IChannel](https://github.com/robgleeson/ichannel).
|
4
5
|
|
5
|
-
The Future starts running right away, but isn't blocking because it runs in its own Process
|
6
|
+
The Future starts running right away, but isn't blocking because it runs in its own fork and uses IChannel to communicate with the parent Process. This allows multithreading with GIL contraints. If the value is asked for and it is ready, it will be returned right away. If the value is asked for early, the Future blocks until delivery.
|
6
7
|
|
7
8
|
## Usage
|
8
9
|
|
data/Rakefile
ADDED
data/ifuture.gemspec
CHANGED
data/lib/ifuture/version.rb
CHANGED
data/test/helper.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require_relative 'helper.rb'
|
2
|
+
|
3
|
+
describe IFuture do
|
4
|
+
before do
|
5
|
+
@future = IFuture.new { sleep 0.25; 'peppermint' }
|
6
|
+
end
|
7
|
+
|
8
|
+
describe 'before the value is ready' do
|
9
|
+
describe 'when asked if ready?' do
|
10
|
+
it 'will respond false' do
|
11
|
+
refute @future.ready?
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe 'when asked for value' do
|
16
|
+
it 'will block then return value' do
|
17
|
+
assert_equal @future.value, "peppermint"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe 'after the value is ready' do
|
23
|
+
before do
|
24
|
+
sleep 0.5
|
25
|
+
end
|
26
|
+
|
27
|
+
describe 'when asked if ready?' do
|
28
|
+
it 'will respond true' do
|
29
|
+
assert @future.ready?
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe 'when asked for value' do
|
34
|
+
it 'will return value' do
|
35
|
+
assert_equal @future.value, "peppermint"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ifuture
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-12-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ichannel
|
@@ -27,6 +27,38 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: minitest
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
30
62
|
- !ruby/object:Gem::Dependency
|
31
63
|
name: ichannel
|
32
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -51,12 +83,16 @@ extensions: []
|
|
51
83
|
extra_rdoc_files: []
|
52
84
|
files:
|
53
85
|
- .gitignore
|
86
|
+
- .travis.yml
|
54
87
|
- Gemfile
|
55
88
|
- LICENSE.txt
|
56
89
|
- README.md
|
90
|
+
- Rakefile
|
57
91
|
- ifuture.gemspec
|
58
92
|
- lib/ifuture.rb
|
59
93
|
- lib/ifuture/version.rb
|
94
|
+
- test/helper.rb
|
95
|
+
- test/ichannel_test.rb
|
60
96
|
homepage: https://github.com/Havenwood
|
61
97
|
licenses: []
|
62
98
|
post_install_message:
|