Jacob Wallström
jacob****@gmail*****
Thu Mar 1 22:49:14 JST 2007
You're right. The self.privateMethod call did work in RubyCocoa 0.4.3d2 so I wrongly assumed that it was legal Ruby. (BTW, this is odd, I thought they meant the same thing, that the self object is just implicit if you don't explicitly give an recipient.) /Jacob On 28 feb 2007, at 17.01, brian hammond wrote: > irb(main):001:0> class A > irb(main):002:1> def initialize > irb(main):003:2> self.foo > irb(main):004:2> end > irb(main):005:1> private > irb(main):006:1> def foo > irb(main):007:2> puts "hi" > irb(main):008:2> end > irb(main):009:1> end > => nil > irb(main):010:0> A.new > NoMethodError: private method `foo' called for #<A:0x7e02c> > from (irb):3:in `initialize' > from (irb):10:in `new' > from (irb):10 > from :0 > > irb(main):011:0> class A > irb(main):012:1> def initialize > irb(main):013:2> foo > irb(main):014:2> end > irb(main):015:1> private > irb(main):016:1> def foo > irb(main):017:2> puts "hi" > irb(main):018:2> end > irb(main):019:1> end > => nil > irb(main):020:0> A.new > hi > > > - Brian > > ----- Original Message ---- > From: Jacob Wallström <jacob****@ghost*****> > To: rubyc****@lists***** > Sent: Wednesday, February 28, 2007 10:53:30 AM > Subject: [Rubycocoa-devel 791] Minor issue with self.privateMethod > > 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 > > > > > > > ______________________________________________________________________ > ______________ > Never miss an email again! > Yahoo! Toolbar alerts you the instant new Mail arrives. > http://tools.search.yahoo.com/toolbar/features/mail/ > _______________________________________________ > Rubycocoa-devel mailing list > Rubyc****@lists***** > http://lists.sourceforge.jp/mailman/listinfo/rubycocoa-devel