[MacRuby] #1388: Can't subclass NSProxy

MacRuby ruby-noreply at macosforge.org
Wed Sep 14 20:10:22 PDT 2011


#1388: Can't subclass NSProxy
---------------------------+------------------------------------------------
 Reporter:  haxie1@…       |       Owner:  lsansonetti@…        
     Type:  defect         |      Status:  new                  
 Priority:  blocker        |   Milestone:                       
Component:  MacRuby        |    Keywords:                       
---------------------------+------------------------------------------------

Comment(by mrada@…):

 As a temporary workaround, you could just implement the required methods
 yourself. I've modified your sample code to make it work:

 {{{
 class << NSProxy
   def method_added meth
   end

   def inherited klass
   end
 end

 class MyProxy < NSProxy
     def initWithTarget(target)
         @target = target
     end
 end

 str = "foo"
 proc = MyProxy.alloc.initWithTarget(str)
 }}}

 That snippet is enough to not throw an exception, but there are a number
 of other callbacks that Ruby makes that might throw exceptions and so you
 will have to implement them all yourself.

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/1388#comment:3>
MacRuby <http://macruby.org/>



More information about the macruby-tickets mailing list