From: Yvon T. <tho...@fr...> - 2006-03-04 09:51:00
|
Le 4 mars 06 =E0 03:12, Tim Burks a =E9crit : > I wrote up an account of one conversion and put it online here: =20 > http://www.rubycocoa.com/the-rubification-of-rtw. OK, i've started one of my own, this is to let you some result. I've choosen the "NameAndAddress" example where the main.m is called =20 "NameAndAddress_main.m". first i've tried using a "NameAndAddress_main.rb" to mimic what's in =20 the original Obj_C project then, i've changed the line : return RBApplicationMain("rb_main.rb", argc, argv); to : return RBApplicationMain("NameAndAddress_main.rb", argc, argv); and add a new file "NameAndAddress_main.rb" having the following =20 content : require 'osx/cocoa' def NameAndAddress_main_init path =3D = OSX::NSBundle.mainBundle.resourcePath.fileSystemRepresentation rbfiles =3D Dir.entries(path).select {|x| /\.rb\z/ =3D~ x} rbfiles -=3D [ File.basename(__FILE__) ] rbfiles.each do |path| require( File.basename(path) ) end end if $0 =3D=3D __FILE__ then NameAndAddress_main_init ####### <=3D=3D=3D line 21 OSX.NSApplicationMain(0, nil) end and get the following error : /Users/yvon/work/CocoaRubyfication/NameAndAddress/build/Default/=20 NameAndAddress.app/Contents/Resources/NameAndAddress_main.rb:21: =20 uninitialized constant NameAndAddress_init (NameError) then i thought the prob arroses only because i've made use of a upper =20= case first letter for this file name, then i rearranged all to : nameAndAddress_main.rb and everything else accordingly. and i've discovered, what i've never used before, that a method, =20 within ruby, couldn't start with an upper case letter ))) hopping this could help others, Yvon |