[MacRuby-devel] Objective-C class +initialize in MacRuby
Laurent Sansonetti
lsansonetti at apple.com
Sun Oct 10 13:24:25 PDT 2010
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 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?
Indeed, +initialize won't be called for pure-Ruby classes. I recommend to use the Ruby idiom here, it's simpler :)
Laurent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20101010/955f8df6/attachment.html>
More information about the MacRuby-devel
mailing list