ione 1.1.0 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/ione/future.rb +5 -0
- data/lib/ione/version.rb +1 -1
- data/spec/ione/future_spec.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8edb1b899493ad38350a6bfaed1c021157fcfbaf
|
4
|
+
data.tar.gz: 39710eb4eec6a84c7212a5c838dd3d7be2f3d1e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0482a3411e1aebd9776501b049004ecc7dc90b4803ca0fe793517abc96a0fdf0afca3e70504c6e20bb198c8868df1dcad82694cf341c274ce6faa2bada82289
|
7
|
+
data.tar.gz: 91804377c9d4b5d80a1f7aa679de5fa07fab046b7ee9145344c77d550d63ac7ca0d57cd4117db585c41cb69852312b21a0ffa93cf8021af0c1a6cb072d4b5bc5
|
data/README.md
CHANGED
@@ -29,6 +29,7 @@ The [examples](https://github.com/iconara/ione/tree/master/examples) directory h
|
|
29
29
|
* [redis_client](https://github.com/iconara/ione/tree/master/examples/redis_client) is a more or less full featured Redis client that uses most of Ione's features.
|
30
30
|
* [http_client](https://github.com/iconara/ione/tree/master/examples/http_client) is a simplistic HTTP client that uses Ione and [http_parser.rb](http://rubygems.org/gems/http_parser.rb) to make HTTP GET request.
|
31
31
|
* [cql-rb](https://github.com/iconara/cql-rb) is a high performance Cassandra driver and where Ione was originally developed.
|
32
|
+
* [ione-rpc](https://github.com/iconara/ione-rpc) is a RPC framework built on Ione. It makes it reasonably easy to build networked applications without having to reinvent the wheel.
|
32
33
|
|
33
34
|
# How to contribute
|
34
35
|
|
data/lib/ione/future.rb
CHANGED
@@ -86,6 +86,7 @@ module Ione
|
|
86
86
|
# futures
|
87
87
|
def all(*futures)
|
88
88
|
return resolved([]) if futures.empty?
|
89
|
+
return futures.first.map { |v| [v] } if futures.size == 1
|
89
90
|
CombinedFuture.new(futures)
|
90
91
|
end
|
91
92
|
|
@@ -97,6 +98,7 @@ module Ione
|
|
97
98
|
# @return [Ione::Future] a future which represents the first completing future
|
98
99
|
def first(*futures)
|
99
100
|
return resolved if futures.empty?
|
101
|
+
return futures.first if futures.size == 1
|
100
102
|
FirstFuture.new(futures)
|
101
103
|
end
|
102
104
|
|
@@ -105,6 +107,7 @@ module Ione
|
|
105
107
|
# @param [Object, nil] value the value of the created future
|
106
108
|
# @return [Ione::Future] a resolved future
|
107
109
|
def resolved(value=nil)
|
110
|
+
return ResolvedFuture::NIL if value.nil?
|
108
111
|
ResolvedFuture.new(value)
|
109
112
|
end
|
110
113
|
|
@@ -468,6 +471,8 @@ module Ione
|
|
468
471
|
|
469
472
|
def on_failure
|
470
473
|
end
|
474
|
+
|
475
|
+
NIL = new(nil)
|
471
476
|
end
|
472
477
|
|
473
478
|
# @private
|
data/lib/ione/version.rb
CHANGED
data/spec/ione/future_spec.rb
CHANGED
@@ -613,6 +613,11 @@ module Ione
|
|
613
613
|
it 'completes with an empty list when no futures are given' do
|
614
614
|
Future.all.value.should == []
|
615
615
|
end
|
616
|
+
|
617
|
+
it 'completes with a list of one item when a single future is given' do
|
618
|
+
f = Future.resolved(1)
|
619
|
+
Future.all(f).value.should == [1]
|
620
|
+
end
|
616
621
|
end
|
617
622
|
end
|
618
623
|
|
@@ -683,6 +688,10 @@ module Ione
|
|
683
688
|
it 'completes with nil when no futures are given' do
|
684
689
|
Future.first.value.should be_nil
|
685
690
|
end
|
691
|
+
|
692
|
+
it 'completes with the value of the given future, when only one is given' do
|
693
|
+
Future.first(Future.resolved('foo')).value.should == 'foo'
|
694
|
+
end
|
686
695
|
end
|
687
696
|
end
|
688
697
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ione
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Theo Hultberg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Reactive programming framework for Ruby, painless evented IO, futures
|
14
14
|
and an efficient byte buffer
|