Re: [MacRuby-devel] Objective-C class +initialize in MacRuby

2010-10-10 Thread Caio Chassot
On 2010-10-10, at 17:24 , Laurent Sansonetti wrote: > > Indeed, +initialize won't be called for pure-Ruby classes. I recommend to use > the Ruby idiom here, it's simpler :) So, the problem I'm seeing is what I alluded to earlier: writing stuff in the class body is more like +load than +initiali

Re: [MacRuby-devel] Objective-C class +initialize in MacRuby

2010-10-10 Thread Laurent Sansonetti
Hi Caio, On Oct 10, 2010, at 9:35 AM, Caio Chassot wrote: > Hi, > > It looks like self.initialize is a no-go: > >class Foo > def self.initialize >NSLog("self.initialize is a sd panda") # <- never runs > end >end > > > The ruby idiom for that would be just: > >

Re: [MacRuby-devel] Objective-C class +initialize in MacRuby

2010-10-10 Thread Caio Chassot
On 2010-10-10, at 15:15 , Matt Aimonetti wrote: > > The problem in your example is that in Ruby, the constructor is an instance > method, not a class method. > So your mistake was to define self.initialize instead of just initialize. I'm afraid you misunderstood my question. I'm not talking abou

Re: [MacRuby-devel] Objective-C class +initialize in MacRuby

2010-10-10 Thread Matt Aimonetti
$ macruby -e "class Foo; def initialize; puts '10/10/10'; end; end; Foo.new" 10/10/10 The problem in your example is that in Ruby, the constructor is an instance method, not a class method. So your mistake was to define self.initialize instead of just initialize. class Foo def initialize

[MacRuby-devel] Objective-C class +initialize in MacRuby

2010-10-10 Thread Caio Chassot
Hi, It looks like self.initialize is a no-go: class Foo def self.initialize NSLog("self.initialize is a sd panda") # <- never runs end end The ruby idiom for that would be just: class Foo NSLog("IM IN UR CLASS INITIALIZEEN FROM RUBY") end is that