Skip to content

Instantly share code, notes, and snippets.

@matzew
Created Oct 30, 2012
Embed
What would you like to do?
Config Object

The Pipeline will have ONE add, that takes a block/config object:

-(id<AGPipe>) add:(void (^)(AGPipeConfig* config)) config;

The "config object" has some type-safe functions to apply certain config options (internally, stored in a NSDictionary...):

@interface AGPipeConfig : NSObject

-(void)type:(NSString*) type;
-(void)baseURL:(NSURL*) baseURL;
// etc...

@end

The usage of the config object, when creating a pipe would look like this:

AGPipeline* pipeline = .......

id<AGPipe> projectsPipe = [pipeline add:^(AGPipeConfig *config) {
    [config name:@"projects"];
    [config type:@"REST"];
    [config baseURL:[NSURL URLWithString:@"https://todo-aerogear.rhcloud.com/todo-server"]];
}];

// read...
[projectsPipe read:.................];
@matzew

This comment has been minimized.

Copy link
Owner Author

@matzew matzew commented Oct 30, 2012

Thinking about making the AG(Pipe)Config a protocol (on the PUBLIC API)....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment