Great! Thanks. Will give a try and let you know if there's any hassles.

Quintin


Cocoa checks to see if the methods really are defined in the actual  
 Objective C class. RubyCocoa doesn't actually define the methods - it  
 relies on forwardInvocation: (a bit like method_missing) to do its  
 work. Hence the problem you're seeing.

 

 I wrote a helper method a while back called 'kvc_array_accessor',  
 which you can see the source of in osx/oc_import.rb.

 

 class Foo < OSX::NSObject
    def initialize
      @things = []
    end
    kvc_array_accessor :things
 end

 

 That should provide access to the ruby array @things. If you want to  
 provide access in a different way, just use the existing  
 implementations of 'countOfThings' etc that you have *after* calling  
 kvc_array_accessor. That should overwrite the methods that are set up  
 for you in there.

 

 I haven't tested this recently, and the above code hasn't been tested  
 either. Hopefully it'll give you enough to get going.