futuroscope 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -0
- data/lib/futuroscope/future.rb +4 -2
- data/lib/futuroscope/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: 3f498b34f03cddab4ebf539fdd57083bb1d91a10
|
4
|
+
data.tar.gz: 7b0ce96ef70f87813fed0ff2d39384a04be5b01c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 886540396354bfd6f74a730e17a8fb60e9bd59d709bd4b4c8205f13334856a647a6033c42ce9d4eaed003b442c97d9d7e0b457f50f3f2f70f5a9bf5e4dc0e096
|
7
|
+
data.tar.gz: 2c098214076c334a5979348b5b2ad2b077579c181945f23a81b19f253a7779777182d6027ee1edfec5d8d5adfdcc1ea9f7f6cb564a4e99f1b6b1f970df6ba30b
|
data/README.md
CHANGED
@@ -56,6 +56,17 @@ puts x + y + z
|
|
56
56
|
=> 6
|
57
57
|
```
|
58
58
|
|
59
|
+
Since a `future` is actually delegating everything to the future's value, there
|
60
|
+
might be some cases where you want to get the actual future's value. You can do
|
61
|
+
it just by calling the `future_value` method on the future:
|
62
|
+
|
63
|
+
```Ruby
|
64
|
+
string = "Ed Balls"
|
65
|
+
x = future{ string }
|
66
|
+
x.future_value === string
|
67
|
+
# => true
|
68
|
+
```
|
69
|
+
|
59
70
|
### Future map
|
60
71
|
```Ruby
|
61
72
|
require 'futuroscope'
|
data/lib/futuroscope/future.rb
CHANGED
@@ -14,7 +14,7 @@ module Futuroscope
|
|
14
14
|
#
|
15
15
|
# future = Futuroscope::Future.new { sleep(1); :edballs }
|
16
16
|
# sleep(1)
|
17
|
-
# future
|
17
|
+
# puts future
|
18
18
|
# => :edballs
|
19
19
|
# # This will return in 1 second and not 2 if the execution wasn't
|
20
20
|
# # deferred to a thread.
|
@@ -43,7 +43,9 @@ module Futuroscope
|
|
43
43
|
@future_value
|
44
44
|
end
|
45
45
|
|
46
|
-
def_delegators :future_value,
|
46
|
+
def_delegators :future_value,
|
47
|
+
:to_s, :==, :kind_of?, :is_a?, :clone, :class, :inspect, :tap, :to_enum,
|
48
|
+
:display, :eql?, :hash, :methods, :nil?
|
47
49
|
|
48
50
|
private
|
49
51
|
|
data/lib/futuroscope/version.rb
CHANGED