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 end end def method_missing(method, *args) @url.send(method, *args) end end On 2010-10-07, at 11: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 MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel