| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- //
- // KeyValue.m
- // CommonLibrary
- //
- // Created by Alexi on 14-7-22.
- // Copyright (c) 2014年 Alexi Chen. All rights reserved.
- //
- #import "KeyValue.h"
- @implementation KeyValue
- + (instancetype)key:(NSString *)key value:(id)value
- {
- return [[KeyValue alloc] initWithKey:key value:value];
- }
- - (instancetype)initWithKey:(NSString *)key value:(id)value
- {
- return [self initWithKey:key value:value action:nil];
- }
- - (instancetype)initWithKey:(NSString *)key value:(id)value action:(KeyValueAction)action
- {
- if (self = [super init])
- {
- self.key = key;
- self.value = value;
- self.action = action;
- }
- return self;
- }
- - (void)keyValueAction
- {
- if (_action)
- {
- _action(self);
- }
- }
- @end
|