fibre 0.9.1 → 0.9.2

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: 78c87ff16a83375685a2a79af98f1d8aeff0d879
4
- data.tar.gz: 661d46f5e3e55949e0c9f0b6d8515a68c81ac7c8
3
+ metadata.gz: c37099c6452b91dc3627b24656c72991eed7a13c
4
+ data.tar.gz: 03e7c7000a4e00d218775bb50b326db2481ecb75
5
5
  SHA512:
6
- metadata.gz: a41f3b41b1c74d0621024c0339f5de1efb27f75921ff60a5835244898b0717e6efb4e91b19b9e76dad4aa6435a1254fb5f6ce191915432d9ecb3e6ce707b13ce
7
- data.tar.gz: 1d2b2f41298fdc5dc7b35ba99d2ae488539e5766a693d9c33e0c06f48b420e90fa4f7bb80c4566efc7f91fda2fd39fd555bbb140acfdaba1be26b3a1c1efcf39
6
+ metadata.gz: dc7f63ee5160019a317e812f58faa58c0958b6f1c6bf8e6bc60e91e10e3be41b5349967f5e22d6279c95c1d14802771fc493e33a00423dcece6b4fb24fdf083b
7
+ data.tar.gz: 3aecdcd1a4d95aaf0532a972772a5a37c24a7fae801e0e8fb460b078f6841288d4a67d1a7504d0607e0db38ccf8d4d554cfb2002ccf1e943e6d1a5a4ad84170a
data/lib/fibre.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "event_object"
2
2
  require "fibre/version"
3
3
  require "fibre/core_ext/fiber"
4
+ require "fibre/core_ext/synchrony"
4
5
 
5
6
  module Fibre
6
7
  autoload :FiberPool, 'fibre/fiber_pool'
@@ -68,8 +68,8 @@ module Fibre
68
68
  before!(spec)
69
69
  spec[:block].call# *Fiber.current.args
70
70
  after!(spec)
71
- rescue Exception => e
72
- # don't raise fiber exceptions
71
+ rescue StandardError => e
72
+ raise e if error.empty?
73
73
  error!(e)
74
74
  end
75
75
 
data/lib/fibre/scope.rb CHANGED
@@ -35,14 +35,5 @@ module Fibre
35
35
  def check
36
36
  fiber.resume if @mocks.all?(&:completed?)
37
37
  end
38
-
39
- module Iterator
40
- def sync
41
- res = Fiber.scope do
42
- collect(&:sync)
43
- end
44
- res.collect(&:result)
45
- end
46
- end
47
38
  end
48
39
  end
data/lib/fibre/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Fibre
2
- VERSION = "0.9.1"
2
+ VERSION = "0.9.2"
3
3
  end
data/spec/fibre_spec.rb CHANGED
@@ -3,6 +3,8 @@ require "spec_helper"
3
3
  describe Fibre do
4
4
  using EventObject
5
5
 
6
+ before { Fibre.pool = nil }
7
+
6
8
  it "should create default pool with default size" do
7
9
  expect(Fibre.pool.size).to be(20)
8
10
  end
@@ -21,7 +23,10 @@ describe Fibre do
21
23
 
22
24
  it "should rescue error in fiber" do
23
25
  expect(probe).to receive(:call)
24
- Fibre.pool.on(:error, &probe)
26
+ Fibre.pool.on(:error) do |error|
27
+ probe.call
28
+ end
29
+
25
30
  Fibre.pool.checkout do
26
31
  raise
27
32
  end
@@ -35,4 +40,24 @@ describe Fibre do
35
40
  end
36
41
  end
37
42
  end
43
+
44
+ it "should raise uncatched exceptions" do
45
+ expect {
46
+ Fibre.pool.checkout do
47
+ raise
48
+ end
49
+ }.to raise_error
50
+ end
51
+
52
+ it "should catch exception" do
53
+ Fibre.pool.on :error do |error|
54
+ # catch exception here
55
+ end
56
+
57
+ expect {
58
+ Fibre.pool.checkout do
59
+ raise
60
+ end
61
+ }.to_not raise_error
62
+ end
38
63
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fibre
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - che
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-16 00:00:00.000000000 Z
11
+ date: 2014-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler