[macruby-changes] [3368] MacRuby/trunk/lib

source_changes at macosforge.org source_changes at macosforge.org
Fri Jan 29 15:40:12 PST 2010


Revision: 3368
          http://trac.macosforge.org/projects/ruby/changeset/3368
Author:   ernest.prabhakar at gmail.com
Date:     2010-01-29 15:40:12 -0800 (Fri, 29 Jan 2010)
Log Message:
-----------
Fixed lib dispatch syntax errors

Modified Paths:
--------------
    MacRuby/trunk/lib/dispatch/actor.rb
    MacRuby/trunk/lib/dispatch/dispatch.rb
    MacRuby/trunk/lib/dispatch/enumerable.rb
    MacRuby/trunk/lib/dispatch.rb

Modified: MacRuby/trunk/lib/dispatch/actor.rb
===================================================================
--- MacRuby/trunk/lib/dispatch/actor.rb	2010-01-29 23:40:10 UTC (rev 3367)
+++ MacRuby/trunk/lib/dispatch/actor.rb	2010-01-29 23:40:12 UTC (rev 3368)
@@ -5,8 +5,9 @@
   # Note that this will NOT work for methods that themselves expect a block
   class Actor
     
-    instance_methods.each |method|
-      undef_method(method) unless method =~ /__(.+)__|method_missing/
+    CRITICAL = /__(.+)__|method_missing|object_id/
+    instance_methods.each do |method|
+      undef_method(method) unless method =~ CRITICAL
     end
   
     # Create an Actor to wrap the given +actee+,
@@ -41,7 +42,7 @@
     end
     
     def method_missing(symbol, *args, &block)
-      if block_given? || not group.nil?
+      if block_given? or not @group.nil?
         callback = @callback
         @q.async(@group) do
           retval = @actee.__send__(symbol, *args)
@@ -54,5 +55,6 @@
         return @retval
       end
     end
+    
   end
 end

Modified: MacRuby/trunk/lib/dispatch/dispatch.rb
===================================================================
--- MacRuby/trunk/lib/dispatch/dispatch.rb	2010-01-29 23:40:10 UTC (rev 3367)
+++ MacRuby/trunk/lib/dispatch/dispatch.rb	2010-01-29 23:40:12 UTC (rev 3368)
@@ -49,7 +49,7 @@
     # providing an API similar to that used by +Threads+
     # if a block is given, instead uses +notify+ to call it asynchronously
     def join(&block)
-      block_given? ? notify &block : wait
+      block_given? ? notify(&block) : wait
     end
   end
 

Modified: MacRuby/trunk/lib/dispatch/enumerable.rb
===================================================================
--- MacRuby/trunk/lib/dispatch/enumerable.rb	2010-01-29 23:40:10 UTC (rev 3367)
+++ MacRuby/trunk/lib/dispatch/enumerable.rb	2010-01-29 23:40:12 UTC (rev 3368)
@@ -54,8 +54,8 @@
     def p_find(&block)
       @found = Dispatch.wrap(nil)
       self.p_each do |obj|
-        found? = @found.nil? ? block.call(obj) : nil
-        @found = obj if found? and @found.nil? 
+        found = @found.nil? ? block.call(obj) : nil
+        @found = obj if found and @found.nil? 
       end
       @found._done # will this leak?
     end

Modified: MacRuby/trunk/lib/dispatch.rb
===================================================================
--- MacRuby/trunk/lib/dispatch.rb	2010-01-29 23:40:10 UTC (rev 3367)
+++ MacRuby/trunk/lib/dispatch.rb	2010-01-29 23:40:12 UTC (rev 3368)
@@ -12,11 +12,9 @@
 # This library provides higher-level services and convenience methods
 # to make it easier for traditional Ruby programmers to add multicore support.
 
-raise "Dispatch only works on Mac OS X 10.6 or later" if MACOSX_VERSION < 10.6
-
 require 'dispatch/actor'
 require 'dispatch/dispatch'
 require 'dispatch/enumerable'
-require 'dispatch/futures'
+require 'dispatch/future'
 require 'dispatch/queue'
 require 'dispatch/queue_source'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100129/d541511b/attachment-0001.html>


More information about the macruby-changes mailing list