Skip to content
Snippets Groups Projects
Commit bc970ae2 authored by Jorge Canizales's avatar Jorge Canizales
Browse files

Fix [GRXWriter emptyWriter] not being reusable.

parent f2b70207
No related branches found
No related tags found
No related merge requests found
...@@ -76,28 +76,15 @@ ...@@ -76,28 +76,15 @@
} }
+ (GRXWriter *)writerWithValue:(id)value { + (GRXWriter *)writerWithValue:(id)value {
if (value) { return [self writerWithEnumerator:[NSEnumerator grx_enumeratorWithSingleValue:value]];
return [self writerWithEnumerator:[NSEnumerator grx_enumeratorWithSingleValue:value]];
} else {
return [self emptyWriter];
}
} }
+ (GRXWriter *)writerWithError:(NSError *)error { + (GRXWriter *)writerWithError:(NSError *)error {
if (error) { return [self writerWithEnumerator:nil error:error];
return [self writerWithEnumerator:nil error:error];
} else {
return [self emptyWriter];
}
} }
+ (GRXWriter *)emptyWriter { + (GRXWriter *)emptyWriter {
static GRXImmediateWriter *emptyWriter; return [self writerWithEnumerator:nil error:nil];
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
emptyWriter = [self writerWithEnumerator:nil error:nil];
});
return emptyWriter;
} }
#pragma mark Conformance with GRXWriter #pragma mark Conformance with GRXWriter
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment