celluloid 0.11.1 → 0.12.0.pre

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.
@@ -55,7 +55,7 @@ module ExampleActorClass
55
55
  end
56
56
  end
57
57
 
58
- def respond_to?(method_name)
58
+ def respond_to?(method_name, include_private = false)
59
59
  super || delegates?(method_name)
60
60
  end
61
61
 
@@ -1,9 +1,4 @@
1
1
  shared_context "a Celluloid Mailbox" do
2
- # Level of timer accuracy enforced by the tests (50ms)
3
- Q = 0.05
4
-
5
- class TestEvent < Celluloid::SystemEvent; end
6
-
7
2
  it "receives messages" do
8
3
  message = :ohai
9
4
 
@@ -11,22 +6,12 @@ shared_context "a Celluloid Mailbox" do
11
6
  subject.receive.should == message
12
7
  end
13
8
 
14
- it "raises system events when received" do
15
- subject.system_event TestEvent.new("example")
16
-
17
- expect do
18
- subject.receive
19
- end.to raise_exception(TestEvent)
20
- end
21
-
22
9
  it "prioritizes system events over other messages" do
23
10
  subject << :dummy1
24
11
  subject << :dummy2
25
- subject.system_event TestEvent.new("example")
26
12
 
27
- expect do
28
- subject.receive
29
- end.to raise_exception(TestEvent)
13
+ subject << Celluloid::SystemEvent.new
14
+ subject.receive.should be_a(Celluloid::SystemEvent)
30
15
  end
31
16
 
32
17
  it "selectively receives messages with a block" do
@@ -50,6 +35,6 @@ shared_context "a Celluloid Mailbox" do
50
35
  started_at = Time.now
51
36
 
52
37
  subject.receive(interval) { false }
53
- (Time.now - started_at).should be_within(Q).of interval
38
+ (Time.now - started_at).should be_within(TIMER_QUANTUM).of interval
54
39
  end
55
40
  end
@@ -0,0 +1,36 @@
1
+ shared_context "a Celluloid Task" do |task_class|
2
+ class MockActor
3
+ attr_reader :tasks
4
+
5
+ def initialize
6
+ @tasks = []
7
+ end
8
+ end
9
+
10
+ let(:task_type) { :foobar }
11
+ let(:suspend_state) { :doing_something }
12
+ let(:actor) { MockActor.new }
13
+
14
+ subject { task_class.new(task_type) { Celluloid::Task.suspend(suspend_state) } }
15
+
16
+ before :each do
17
+ Thread.current[:actor] = actor
18
+ end
19
+
20
+ after :each do
21
+ Thread.current[:actor] = nil
22
+ end
23
+
24
+ it "begins with status :new" do
25
+ subject.status.should == :new
26
+ end
27
+
28
+ it "resumes" do
29
+ subject.should be_running
30
+ subject.resume
31
+ subject.status.should == suspend_state
32
+ subject.resume
33
+ subject.should_not be_running
34
+ end
35
+
36
+ end
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: celluloid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.1
5
- prerelease:
4
+ version: 0.12.0.pre
5
+ prerelease: 7
6
6
  platform: ruby
7
7
  authors:
8
8
  - Tony Arcieri
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-17 00:00:00.000000000 Z
12
+ date: 2012-09-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: timers
16
- requirement: &70167227984140 !ruby/object:Gem::Requirement
16
+ requirement: &70213085365480 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70167227984140
24
+ version_requirements: *70213085365480
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &70167227983760 !ruby/object:Gem::Requirement
27
+ requirement: &70213085364540 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70167227983760
35
+ version_requirements: *70213085364540
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &70167227983300 !ruby/object:Gem::Requirement
38
+ requirement: &70213085363780 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70167227983300
46
+ version_requirements: *70213085363780
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: benchmark_suite
49
- requirement: &70167227982880 !ruby/object:Gem::Requirement
49
+ requirement: &70213085363200 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70167227982880
57
+ version_requirements: *70213085363200
58
58
  description: Celluloid enables people to build concurrent programs out of concurrent
59
59
  objects just as easily as they build sequential programs out of sequential objects
60
60
  email:
@@ -66,10 +66,10 @@ files:
66
66
  - README.md
67
67
  - lib/celluloid/actor.rb
68
68
  - lib/celluloid/actor_proxy.rb
69
+ - lib/celluloid/boot.rb
69
70
  - lib/celluloid/calls.rb
70
71
  - lib/celluloid/core_ext.rb
71
72
  - lib/celluloid/cpu_counter.rb
72
- - lib/celluloid/events.rb
73
73
  - lib/celluloid/fiber.rb
74
74
  - lib/celluloid/fsm.rb
75
75
  - lib/celluloid/future.rb
@@ -77,6 +77,7 @@ files:
77
77
  - lib/celluloid/links.rb
78
78
  - lib/celluloid/logger.rb
79
79
  - lib/celluloid/mailbox.rb
80
+ - lib/celluloid/method.rb
80
81
  - lib/celluloid/notifications.rb
81
82
  - lib/celluloid/pool_manager.rb
82
83
  - lib/celluloid/receivers.rb
@@ -86,7 +87,10 @@ files:
86
87
  - lib/celluloid/signals.rb
87
88
  - lib/celluloid/supervision_group.rb
88
89
  - lib/celluloid/supervisor.rb
90
+ - lib/celluloid/system_events.rb
89
91
  - lib/celluloid/task.rb
92
+ - lib/celluloid/tasks/task_fiber.rb
93
+ - lib/celluloid/tasks/task_thread.rb
90
94
  - lib/celluloid/thread_handle.rb
91
95
  - lib/celluloid/uuid.rb
92
96
  - lib/celluloid/version.rb
@@ -94,6 +98,7 @@ files:
94
98
  - spec/support/actor_examples.rb
95
99
  - spec/support/example_actor_class.rb
96
100
  - spec/support/mailbox_examples.rb
101
+ - spec/support/task_examples.rb
97
102
  homepage: https://github.com/celluloid/celluloid
98
103
  licenses:
99
104
  - MIT
@@ -1,26 +0,0 @@
1
- module Celluloid
2
- # Exceptional system events which need to be processed out of band
3
- class SystemEvent < Exception; end
4
-
5
- # An actor has exited for the given reason
6
- class ExitEvent < SystemEvent
7
- attr_reader :actor, :reason
8
-
9
- def initialize(actor, reason = nil)
10
- @actor, @reason = actor, reason
11
- super reason.to_s
12
- end
13
- end
14
-
15
- # Name an actor at the time it's registered
16
- class NamingRequest < SystemEvent
17
- attr_reader :name
18
-
19
- def initialize(name)
20
- @name = name
21
- end
22
- end
23
-
24
- # Request for an actor to terminate
25
- class TerminationRequest < SystemEvent; end
26
- end