Laurent Sansonetti
lsans****@apple*****
Thu Mar 1 01:11:54 JST 2007
Looks like a Ruby bug, #method_missing is triggered when trying to call an existing private method. The following patch fixes the problem but it breaks some tests, will try to make a better patch :) Index: framework/src/ruby/osx/objc/oc_wrapper.rb =================================================================== --- framework/src/ruby/osx/objc/oc_wrapper.rb (revision 1603) +++ framework/src/ruby/osx/objc/oc_wrapper.rb (working copy) @@ -44,12 +44,16 @@ end def method_missing(mname, *args) - m_name, m_args, as_predicate = analyze_missing(mname, args) - result = self.ocm_send(m_name, *m_args) - if as_predicate && result.is_a?(Integer) then - result != 0 + if self.respond_to?(mname, true) + self.send(mname, *args) else - result + m_name, m_args, as_predicate = analyze_missing(mname, args) + result = self.ocm_send(m_name, *m_args) + if as_predicate && result.is_a?(Integer) then + result != 0 + else + result + end end end Laurent On Feb 28, 2007, at 4:53 PM, Jacob Wallström wrote: > I discovered that the following won't work using Rubycocoa-unstable > (revision 1600). > > class MyClass < OSX::NSObject > > def publicMethod > self.privateMethod # gives error method not found > privateMethod # works > end > > private > > def privateMethod > end > end > > Since it is valid to call private methods in ruby using the self > notation, I think it should work in RubyCocoa too. > > Best regards, > Jacob Wallström > http://ghostparksoftware.com > > > _______________________________________________ > Rubycocoa-devel mailing list > Rubyc****@lists***** > http://lists.sourceforge.jp/mailman/listinfo/rubycocoa-devel