forked from ericmeyer/ObjectiveCSlim
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTestQuery.m
More file actions
36 lines (29 loc) · 966 Bytes
/
TestQuery.m
File metadata and controls
36 lines (29 loc) · 966 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#import "TestQuery.h"
#import "SlimList.h"
#import "SlimListSerializer.h"
@interface TestQuery ()
@property (nonatomic, strong) NSArray *tableData;
@end
@implementation TestQuery
-(id) initWithString:(NSString*) givenString {
if ((self = [super init])) {
self.date = [[self tableDateFormatter] dateFromString:givenString];
}
return self;
}
- (NSDateFormatter*)tableDateFormatter {
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"dd-MMM-yyyy"];
return df;
}
- (void)table:(NSArray*)table {
self.tableData = table;
}
-(NSArray*) query {
NSMutableDictionary *lastRow = [NSMutableDictionary dictionaryWithDictionary:[self.tableData lastObject]];
[lastRow setValue:@"Bradbury" forKey:@"Last Name"];
[lastRow setValue:[[self tableDateFormatter] stringFromDate:self.date] forKey:@"Hire Date"];
NSArray *results = @[self.tableData[0],self.tableData[1],lastRow];
return results;
}
@end