Re: [MacRuby-devel] URI and NSURL compatibility

2010-10-07 Thread Joshua Ballanco
This is Ruby, where everything is an expression. If you're going to be clever, why not go all the way? --- def is_macruby?; defined?(RUBY_ENGINE) && RUBY_ENGINE == 'macruby'; end if is_macruby? framework 'Foundation' else require 'uri' COMPONENTS = [:scheme, :userinfo, :host, :port, :regis

Re: [MacRuby-devel] URI and NSURL compatibility

2010-10-07 Thread Laurent Sansonetti
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 r

Re: [MacRuby-devel] URI and NSURL compatibility

2010-10-07 Thread Mark Rada
A more efficient version of that class: class HackURI if RUBY_ENGINE == 'macruby' def initialize(uri) @url = NSURL.URLWithString uri end else def initialize(uri) @url = URI.parse uri

[MacRuby-devel] URI and NSURL compatibility

2010-10-07 Thread Mark Rada
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 MacR