[MacRuby-devel] How to use custom C struct's?

Clay Bridges diffengr at gmail.com
Wed Aug 5 09:43:15 PDT 2009


> Yes, use RubyCocoa

I'm afraid I'm already hooked. ;)

If it comes down to it, I've already put a testing-only category wrapper
around one method, e.g.

#import "Cell.h"

@interface Cell (TestUtil)

@property (readonly) NSArray* mapPointAsArray;

@end

@implementation Cell (TestUtil)

@dynamic mapPointAsArray;

// this method is simply for ruby-side testing
- (NSArray*) mapPointAsArray {
    NSMutableArray* nsma = [[NSMutableArray alloc] initWithCapacity:2];
    [nsma addObject:[NSNumber numberWithInt:mapPoint.row]];
    [nsma addObject:[NSNumber numberWithInt:mapPoint.col]];
    return [nsma autorelease];
}

@end

Not too much work to do it for the others. Of course, one could argue what
I'm really testing here, but the craftsman in me says it's OK.

Clay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20090805/7470b1cc/attachment.html>


More information about the MacRuby-devel mailing list