[MacRuby-devel] CFRange (Boxed) elements not accessible
Hello Laurent and team, The following code: string_range = CTLineGetStringRange(line) returns a CFRange, which is a C-structure with two elements: location and length. Attempting to access: string_range.location results in the error message: undefined method `location' for # (NoMethodError) (I think a similar error related to CLLocation has been discussed here before.) Is there a way to get around this problem? - Paul Howson Warwick Qld Australia ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] CFRange (Boxed) elements not accessible
Hi Paul, I believe that here the function is typed to return an anonymous struct (likely a bug in the bridgesupport file), so MacRuby won't be able to associate it as an NSRange. You may be able to access location using string_range[0] and length using string_range[1]. Laurent On May 30, 2010, at 6:19 PM, Paul Howson wrote: > Hello Laurent and team, > > The following code: > > string_range = CTLineGetStringRange(line) > > returns a CFRange, which is a C-structure with two elements: location and > length. > > Attempting to access: > > string_range.location > > results in the error message: > > undefined method `location' for # (NoMethodError) > > (I think a similar error related to CLLocation has been discussed here > before.) > > Is there a way to get around this problem? > > - > Paul Howson > Warwick Qld Australia > ___ > 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
Re: [MacRuby-devel] CFRange (Boxed) elements not accessible
On 31/05/2010, at 11:47 AM, Laurent Sansonetti wrote: > Hi Paul, > > I believe that here the function is typed to return an anonymous struct > (likely a bug in the bridgesupport file), so MacRuby won't be able to > associate it as an NSRange. You may be able to access location using > string_range[0] and length using string_range[1]. > > Laurent Thanks Laurent. That appears not to work: undefined method `[]' for # (NoMethodError) Is the bridgesupport file produced elsewhere within Apple? (i.e. out of your control) Any other suggestions for getting around this bug? Thanks, Paul - Paul Howson Warwick Qld Australia ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
