Skip to content

Instantly share code, notes, and snippets.

@matzew
Created October 30, 2012 11:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matzew/3979665 to your computer and use it in GitHub Desktop.
Save matzew/3979665 to your computer and use it in GitHub Desktop.
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
Copy link
Author

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