futuroscope 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a472750ba1f0d8f4ecd235cf7320b0351369fcbf
4
- data.tar.gz: fb27ab2a0769f68ea1c3870bafb812ae2591ae45
3
+ metadata.gz: 337e18c04c9dafa5a2680bc3f1565fa1f8fd93e2
4
+ data.tar.gz: 178323eacd389f23797b512639853a6a00e2a4db
5
5
  SHA512:
6
- metadata.gz: 3c10d72125eabfe267a48f6bc0a3c5c9d144da4d6727f42a6500957025bfcd666c8b10e51c53b57aebfb23b2b0099d3537e4e9770b4b6918d4bf85e139903eab
7
- data.tar.gz: e2abc633d1b80451e82bfeb4189e21b4490f3032300249560dd0e034c961dde0a247acfe102f37b5380c154419855f87abafecb31f69c9986917a421d057a6fb
6
+ metadata.gz: b4c25e2154015c1165048966eac5fd73de8193b944428b95c41e7b21cebb6d2e5f721bef55fcfe7ef2864d4dd8338e41ffe4ac5f043477dd0f98678eda06a8ce
7
+ data.tar.gz: 6863eb57bce929a577d196e4ce2a6a477deec66f032292f9efee777d3e21fb2ad7073c7d86735ea16886e6627886380063a0686af3f4ee2b7e1c820b6ec8b82e
data/README.md CHANGED
@@ -5,6 +5,8 @@
5
5
  [![Coverage Status](https://coveralls.io/repos/codegram/futuroscope/badge.png?branch=master)](https://coveralls.io/r/codegram/futuroscope)
6
6
  [![Dependency Status](https://gemnasium.com/codegram/futuroscope.png)](https://gemnasium.com/codegram/futuroscope)
7
7
 
8
+ **Join a live discussion on Gitter**: [![Gitter chat](https://badges.gitter.im/codegram/futuroscope.png)](https://gitter.im/codegram/futuroscope)
9
+
8
10
  Futursocope is a simple library that implements futures in ruby. Futures are a
9
11
  concurrency pattern meant to help you deal with threads in a simple, transparent way.
10
12
 
@@ -46,10 +46,7 @@ module Futuroscope
46
46
  #
47
47
  # Returns the Future's block execution result.
48
48
  def __getobj__
49
- resolved = resolved_future_value
50
-
51
- raise resolved[:exception] if resolved[:exception]
52
- resolved[:value]
49
+ resolved_future_value_or_raise[:value]
53
50
  end
54
51
 
55
52
  def __setobj__ obj
@@ -57,7 +54,7 @@ module Futuroscope
57
54
  end
58
55
 
59
56
  def marshal_dump
60
- resolved_future_value
57
+ resolved_future_value_or_raise
61
58
  end
62
59
 
63
60
  def marshal_load value
@@ -70,6 +67,13 @@ module Futuroscope
70
67
 
71
68
  private
72
69
 
70
+ def resolved_future_value_or_raise
71
+ resolved = resolved_future_value
72
+
73
+ raise resolved[:exception] if resolved[:exception]
74
+ resolved
75
+ end
76
+
73
77
  def resolved_future_value
74
78
  @resolved_future || @mutex.synchronize do
75
79
  @resolved_future ||= @queue.pop
@@ -1,3 +1,3 @@
1
1
  module Futuroscope
2
- VERSION = "0.1.9"
2
+ VERSION = "0.1.10"
3
3
  end
@@ -59,6 +59,14 @@ module Futuroscope
59
59
  expect(Marshal.load(dumped).future_value).to eq(object)
60
60
  end
61
61
 
62
+ it "re-raises captured exception when trying to marshal" do
63
+ future = Future.new{ raise Exception }
64
+
65
+ expect(lambda{
66
+ Marshal.dump(future)
67
+ }).to raise_error(Exception)
68
+ end
69
+
62
70
  it "correctly duplicates a future object" do
63
71
  object = [1, 2, 3]
64
72
  future = Future.new { object }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: futuroscope
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Jaume Rey Peroy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-31 00:00:00.000000000 Z
11
+ date: 2014-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler