blob: 7da05d13c490db7b0e1a53efcafee56d0e1eb25f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#import "NSEnumerator+GRXUtil.h"
#import "private/GRXNSBlockEnumerator.h"
#import "private/GRXNSFastEnumerator.h"
#import "private/GRXNSScalarEnumerator.h"
@implementation NSEnumerator (GRXUtil)
+ (NSEnumerator *)grx_enumeratorWithContainer:(id<NSFastEnumeration>)container {
// TODO(jcanizales): Consider checking if container responds to objectEnumerator and return that?
return [[GRXNSFastEnumerator alloc] initWithContainer:container];
}
+ (NSEnumerator *)grx_enumeratorWithSingleValue:(id)value {
return [[GRXNSScalarEnumerator alloc] initWithValue:value];
}
+ (NSEnumerator *)grx_enumeratorWithValueSupplier:(id (^)())block {
return [[GRXNSBlockEnumerator alloc] initWithValueSupplier:block];
}
@end
|