[MacRuby-devel] super_foo style RubyCocoa messages.

Eloy Duran eloy.de.enige at gmail.com
Sun May 4 10:20:39 PDT 2008


I've started work on a RubyCocoa layer for MacRuby (still very naive).

Like already discussed with Laurent, an API to be able to call the  
superclass implementation of a method
will be necessary for super_foo style methods to work. Imagine this  
code:

class Foo < OSX::NSObject
   def init
     self if super_init
   end
end

Something like this will be needed:

class OSX::NSObject
   def method_missing(mname, *args, &block)
     if superclass_method?(mname)
       # convert mname to selector
       super_send(selector, *args) # <- #super_send (or something like  
it) should be able to send a message to the superclasses implementation.
     else
       original_method_missing(mname, *args, &block)
     end
   end
end

I hope this is clear enough?

Cheers,
Eloy


More information about the MacRuby-devel mailing list