Skip to content

Instantly share code, notes, and snippets.

Created Oct 30, 2012
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...


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:@""]];

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

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