[MacRuby-devel] control tower with objective-c class

Laurent Sansonetti lsansonetti at apple.com
Wed Oct 6 13:55:46 PDT 2010


Hi Louis-Philippe,

Could you paste all this into a new ticket? This way we won't forget to fix it.

Thanks!
Laurent

On Oct 6, 2010, at 1:12 PM, Louis-Philippe wrote:

> my Objective-C class:
> 
> __________________________________________
> @implementation ObjcRackApp
> 
> - (NSArray*)call:(NSDictionary *)env {
> 
> return [NSArray arrayWithObjects:
> 
> [NSNumber numberWithInteger:200],
> 
> [NSDictionary dictionaryWithObject:@"text/plain" forKey:@"Content-Type"],
> 
> @"Hello Objc!",
> 
> nil];
> 
> }
> 
> @end
> 
> ________________________________________________
> 
> 
> I can confirm it load and behaves properly with this script:
> 
> ________________________________________________
> 
> framework "ObjcRackApp.framework"
> 
> class Hello
>   def call(env)
>     [200, { 'Content-Type' => 'text/plain' }, "Hello Control Tower!"]
>   end
> end
> 
> env = {"a"=>"hash"}
> 
> arr = ObjcRackApp.alloc.init.call(env)
> 
> puts arr.class
> puts arr[0].class
> puts arr[1].class
> puts arr[2].class
> 
> arr = Hello.new.call(env)
> 
> puts arr.class
> puts arr[0].class
> puts arr[1].class
> puts arr[2].class
> 
> __________________________________________
> 
> which print:
> __________________________________________
> 
> Array
> Fixnum
> Hash
> String
> Array
> Fixnum
> Hash
> String
> 
> __________________________________________
> 
> but when I run:
> 
> __________________________________________
> 
> framework "ObjcRackApp.framework"
> 
> app = ObjcRackApp.alloc.init
> run app
> 
> __________________________________________
> 
> with control_tower -R hello_objc.ru, the server starts without error but I get served a blank page in my browser
>  
> 
> 2010/10/6 Joshua Ballanco <joshua.ballanco at apple.com>
> Hi L-P,
> 
> That sounds like a neat idea! I can think of a few ways that it might go wrong, but they're only guesses. Do you have some small sample code that demonstrates the problem? If so, can you open a ticket on track (https://www.macruby.org/auth/login/?next=/trac/newticket) and set the component to "ControlTower"? Thanks!
> 
> Cheers,
> 
> Josh
> 
> 
> On Oct 6, 2010, at 11:36 AM, Louis-Philippe wrote:
> 
> > Hi all,
> >
> > I'm experimenting with Control Tower and tought I would try to get it running with an Objective-C class, inside an imported framework, implementing the Rack protocol.
> >
> > My class imports right in macruby, has a proper call(env) method which returns an array of 3 elements, when I call inspect on it it is same, same same as the macruby one... but control tower doesn't display my return string???
> >
> > any idea?
> >
> > L-P
> > _______________________________________________
> > MacRuby-devel mailing list
> > MacRuby-devel at lists.macosforge.org
> > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20101006/4f53da2f/attachment.html>


More information about the MacRuby-devel mailing list