8 Oct
2010
8 Oct
'10
3:11 a.m.
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