hyperoslo / NSString-HYPRelationshipParser

Parse string representations of model relationships
http://hyper.no
Other
1 stars 0 forks source link

Inverse method #7

Closed 3lvis closed 9 years ago

3lvis commented 9 years ago

Would be great to have a method that by sending a relationship, an index and an attribute would return a key

NSString *flatKey = [NSString hyp_keyWithRelationship:@"contacts" index:2 attribute:@"first_name"];
// contacts[2].first_name
NSString *flatKey = [NSString hyp_keyWithRelationship:@"contacts" index:2];
// contacts[2]
NSString *flatKey = [NSString hyp_keyWithRelationship:@"company" attribute:@"name"];
// company.name
NSString *flatKey = [@"contacts[2].first_name" hyp_updateRelationshipIndex:3];
// contacts[3].first_name
zenangst commented 9 years ago

I was thinking about this when doing the pull request, this would be amazing.

3lvis commented 9 years ago

Fixed