Hi Mark,

No, NSURL and URI are not bridged.

I do not recommend using NSURL in a file that should also run under MRI because 
of the MacRuby calling syntax for Objective-C selectors, which won't compile 
under normal rubies. So, it would be better to isolate the NSURL code in a 
special file and require it at demand (if RUBY_ENGINE is macruby).

Laurent

On Oct 7, 2010, at 8:11 PM, Mark Rada wrote:

> Hi devs,
> 
> I am trying to write a gem so that it will run on MRI and MacRuby, but still 
> be able to take advantage of MacRuby things like Cocoa and GCD.
> 
> I was playing around with some URI related stuff and I cannot find much 
> documentation on whether NSURL and URI objects have been bridged for MacRuby?
> 
> If they aren't bridged, I was thinking I could just hack together an empty 
> class that just chooses if it inherits from NSURL or URI at run time.
> Something like this:
> 
>       require 'uri'
>       
>       class HackURI 
>               def initialize(uri)
>                        if RUBY_ENGINE == 'macruby'
>                               @url = NSURL.URLWithString uri
>                        else
>                               @url = URI.parse uri
>                       end
>                end
>       
>               def method_missing(method, *args)
>                       @url.send(method, *args)
>               end
>       end 
> 
> --
> Mark Rada
> 
> _______________________________________________
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

_______________________________________________
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to