> From: Thibault Martin-Lagardette <thibault...@gmail.com> > > What you can do is a "factory" just like this: > ...
> You can also do a more Cocoa-ish way: > ... > Hope that helps! yep, that all works... I'd rather be doing it in a more Ruby-ish way though... :) Is the fact that the Ruby-standard initialize method is not called for Ruby classes descended from Obj-C classes expected? To me, at least, it violates the principle of least surprise... for example, in ruby 1.9.1 we see initialize being called ru...@worcestershire:~$ irb1.9.1 irb(main):001:0> class C2 < String irb(main):002:1> attr_accessor :foo irb(main):003:1> def initialize foo = "default2" irb(main):004:2> @foo = foo irb(main):005:2> STDERR.puts "setting #{foo}" irb(main):006:2> end irb(main):007:1> end => nil irb(main):008:0> c2 = C2.new setting default2 => "" irb(main):009:0> but not in macruby 0.6 ru...@alcazar:~$ macirb irb(main):001:0> class C2 < String irb(main):002:1> attr_accessor :foo irb(main):003:1> def initialize foo = "default2" irb(main):004:2> @foo = foo irb(main):005:2> STDERR.puts "setting #{foo}" irb(main):006:2> end irb(main):007:1> end => nil irb(main):008:0> c2 = C2.new => "" irb(main):009:0> _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel