ObjC_Rubyfication
ObjC_Rubyfication copied to clipboard
Attempt to make Objective-C more like Ruby
h2. Objective-C Rubyfication Project
Objective-C is a great language and Cocoa provides a great set of tools. But if you are like me and came from Ruby, you will miss lots of things. Some things can be achieved in Obj-C but with added verbosity.
But, Obj-C has features such as Blocks, Categories, Selectors, Variable length arguments list for methods, and this allow us to emulate much of the Ruby standard libraries and syntax to Obj-C.
The idea is to implement Categories to add Ruby-ish features to existing Obj-C classes such as NSString and NSArray.
Then you can code like this:
NSString* a = @"hello\nworld\nagain";
NSMutableArray* b = [[NSMutableArray alloc] init];
[a eachLine:^(NSString* line){
[b addObject:line];
}];
NSDate* ref = [NSDate parse:@"2010-01-01 10:15:30"];
Feel free to add new features and let me know if this is useful or not, right now I am doing this just for the fun of it.
h2. Credits
- "Fabio Akita":http://www.akitaonrails.com
- "Satoshi Nakagawa":https://github.com/psychs/cocoaoniguruma/ for the Oniguruma port
- "Allen Ding":https://github.com/allending/Kiwi for Kiwi