forked from karelia/MockServer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKMSTranscriptEntry.m
More file actions
42 lines (33 loc) · 1.09 KB
/
KMSTranscriptEntry.m
File metadata and controls
42 lines (33 loc) · 1.09 KB
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
37
38
39
40
41
42
// Created by Sam Deane on 18/12/2012.
// Copyright (c) 2012 Karelia Software. All rights reserved.
//
#import "KMSTranscriptEntry.h"
@implementation KMSTranscriptEntry
+ (KMSTranscriptEntry*)entryWithType:(KMSTranscriptEntryType)type value:(id)value
{
KMSTranscriptEntry* entry = [[KMSTranscriptEntry alloc] init];
entry.type = type;
entry.value = value;
return [entry autorelease];
}
- (void)dealloc
{
[_value release];
[super dealloc];
}
- (NSString*)description
{
NSArray* typeStrings = @[@"Input", @"Output", @"Command"];
NSString* valueString = [self.value description];
NSRange range = [valueString rangeOfCharacterFromSet:[NSCharacterSet newlineCharacterSet]];
if (range.location != NSNotFound)
{
valueString = [NSString stringWithFormat:@"%@…", [valueString substringToIndex:range.location]];
}
if ([valueString length] > 20)
{
valueString = [NSString stringWithFormat:@"%@…", [valueString substringToIndex:19]];
}
return [NSString stringWithFormat:@"<%@: %@>", typeStrings[self.type], valueString];
}
@end