[macruby-changes] [3412] MacRuby/trunk

source_changes at macosforge.org source_changes at macosforge.org
Tue Feb 2 12:58:44 PST 2010


Revision: 3412
          http://trac.macosforge.org/projects/ruby/changeset/3412
Author:   ernest.prabhakar at gmail.com
Date:     2010-02-02 12:58:43 -0800 (Tue, 02 Feb 2010)
Log Message:
-----------
Make Dispatch::Actor set persistent queue/group

Modified Paths:
--------------
    MacRuby/trunk/lib/dispatch/actor.rb
    MacRuby/trunk/spec/macruby/library/dispatch/actor_spec.rb

Modified: MacRuby/trunk/lib/dispatch/actor.rb
===================================================================
--- MacRuby/trunk/lib/dispatch/actor.rb	2010-02-02 15:26:50 UTC (rev 3411)
+++ MacRuby/trunk/lib/dispatch/actor.rb	2010-02-02 20:58:43 UTC (rev 3412)
@@ -14,19 +14,20 @@
     # optionally specifying the default +callback+ queue
     def initialize(delegate, callback=nil)
       super(delegate)
-      @default_callback = callback || Dispatch::Queue.concurrent
-      @callback = @default_callback
+      @callback = callback || Dispatch::Queue.concurrent
       @q = Dispatch::Queue.new("dispatch.actor.#{delegate}.#{object_id}")
     end
         
-    # Specify the +callback+ queue for the next async request
+    # Specify the +callback+ queue for async requests
     def _on_(callback)
       @callback = callback
+      self
     end
 
-    # Specify the +group+ for the next async request
+    # Specify the +group+ for async requests
     def _with_(group)
       @group = group
+      self
     end
 
     # Wait until the internal private queue has completed execution
@@ -44,8 +45,6 @@
           retval = __getobj__.__send__(symbol, *args)
           callback.async { block.call(retval) } if not callback.nil?
         end
-        @callback = @default_callback if not @callback == @default_callback
-        @group = nil if not @group.nil?
         return nil
       else
         #puts "\nSync #{symbol.inspect}" if symbol != :__

Modified: MacRuby/trunk/spec/macruby/library/dispatch/actor_spec.rb
===================================================================
--- MacRuby/trunk/spec/macruby/library/dispatch/actor_spec.rb	2010-02-02 15:26:50 UTC (rev 3411)
+++ MacRuby/trunk/spec/macruby/library/dispatch/actor_spec.rb	2010-02-02 20:58:43 UTC (rev 3412)
@@ -78,7 +78,7 @@
       @qs.should =~ /com.apple.root.default/
     end
 
-    it "should use initial callback queue if any, when called Asynchronously" do
+    it "should use specified callback queue when called Asynchronously" do
       qn = Dispatch::Queue.new("custom")
       @actor2 = Dispatch::Actor.new(@actee, qn)
       @qs = ""
@@ -87,25 +87,17 @@
       @qs.should == qn.label
     end
 
-    it "should use callback queue specified by _on, but only once" do
+    it "should use callback queue specified by _on" do
       true.should == true
     end
 
-    it "should invoke actee once with group specified by _with" do
+    it "should invoke actee async with group specified by _with" do
       true.should == true
     end
 
-    it "should invoke actee Asynchronously when group specified by _with" do
-      true.should == true
-    end
-
     it "should return actee when called with _done" do
       true.should == true
     end
-
-    it "should return an actor for Dispatch.wrap" do
-      true.should == true
-    end
-
   end
+  
 end
\ No newline at end of file
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100202/4176231a/attachment-0001.html>


More information about the macruby-changes mailing list