| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- //
- // TBKeyPath.m
- // TBTweakViewController
- //
- // Created by Tanner on 3/22/17.
- // Copyright © 2017 Tanner Bennett. All rights reserved.
- //
- #import "TBKeyPath.h"
- @interface TBKeyPath () {
- NSString *tb_description;
- }
- @end
- @implementation TBKeyPath
- + (instancetype)bundle:(TBToken *)bundle
- class:(TBToken *)cls
- method:(TBToken *)method
- isInstance:(NSNumber *)instance
- string:(NSString *)keyPathString {
- TBKeyPath *keyPath = [self new];
- keyPath->_bundleKey = bundle;
- keyPath->_classKey = cls;
- keyPath->_methodKey = method;
- keyPath->_instanceMethods = instance;
- // Remove irrelevant trailing '*' for equality purposes
- if ([keyPathString hasSuffix:@"*"]) {
- keyPathString = [keyPathString substringToIndex:keyPathString.length];
- }
- keyPath->tb_description = keyPathString;
- return keyPath;
- }
- - (NSString *)description {
- return tb_description;
- }
- - (NSUInteger)hash {
- return tb_description.hash;
- }
- - (BOOL)isEqual:(id)object {
- if ([object isKindOfClass:[TBKeyPath class]]) {
- TBKeyPath *kp = object;
- return [tb_description isEqualToString:kp->tb_description];
- }
- return NO;
- }
- @end
|