$ 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 puts "initialize is a haaaapy panda" end end Foo.new - Matt On Sun, Oct 10, 2010 at 11:35 AM, Caio Chassot <li...@caiochassot.com>wrote: > Hi, > > It looks like self.initialize is a no-go: > > class Foo > def self.initialize > NSLog("self.initialize is a saaaad 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 ok in the context of Cocoa applications? Is there a better way? > > _______________________________________________ > MacRuby-devel mailing list > MacRuby-devel@lists.macosforge.org > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel >
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel