Browse files

Guess I haven't coded without ARC in a while; fix class

  • Loading branch information...
1 parent 1c495d4 commit ae413107f43b99af7448e223db108955716f34c4 @p2 committed Feb 4, 2014
Showing with 13 additions and 7 deletions.
  1. +4 −1 FileExport/PPStringFormatTransformPair.h
  2. +9 −6 FileExport/PPStringFormatTransformPair.m
View
5 FileExport/PPStringFormatTransformPair.h
@@ -13,7 +13,10 @@
/**
* A class that transforms occurrences of "from" to "to" in a mutable string.
*/
-@interface PPStringFormatTransformPair : NSObject <NSCoding, NSCopying>
+@interface PPStringFormatTransformPair : NSObject <NSCoding, NSCopying> {
+ NSString *from;
+ NSString *to;
+}
@property (nonatomic, retain) NSString *from;
@property (nonatomic, retain) NSString *to;
View
15 FileExport/PPStringFormatTransformPair.m
@@ -13,6 +13,9 @@
@implementation PPStringFormatTransformPair
+@synthesize from;
+@synthesize to;
+
+ (NSArray *) transformPairsFromTo:(NSString *)first, ...
{
@@ -78,8 +81,8 @@ - (id) initWithCoder:(NSCoder *)aDecoder
- (void) encodeWithCoder:(NSCoder *)aCoder
{
- [aCoder encodeObject:_from forKey:@"from"];
- [aCoder encodeObject:_to forKey:@"to"];
+ [aCoder encodeObject:from forKey:@"from"];
+ [aCoder encodeObject:to forKey:@"to"];
}
@@ -88,8 +91,8 @@ - (void) encodeWithCoder:(NSCoder *)aCoder
- (id) copyWithZone:(NSZone *)zone
{
PPStringFormatTransformPair *copy = [[self class] new];
- copy.from = _from;
- copy.to = _to;
+ copy.from = from;
+ copy.to = to;
return copy;
}
@@ -100,7 +103,7 @@ - (id) copyWithZone:(NSZone *)zone
- (NSMutableString *) transform:(NSMutableString *)string
{
if (nil != string) {
- [string replaceOccurrencesOfString:_from withString:_to options:0 range:NSMakeRange(0, [string length])];
+ [string replaceOccurrencesOfString:from withString:to options:0 range:NSMakeRange(0, [string length])];
}
return string;
}
@@ -110,7 +113,7 @@ - (NSMutableString *) transform:(NSMutableString *)string
#pragma mark - Utilities
- (NSString *) description
{
- return [NSString stringWithFormat:@"%@ <%p> from '%@' to '%@'", NSStringFromClass([self class]), self, _from, _to];
+ return [NSString stringWithFormat:@"%@ <%p> from '%@' to '%@'", NSStringFromClass([self class]), self, from, to];
}

0 comments on commit ae41310

Please sign in to comment.