rm-extensions 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +0 -1
- data/lib/motion/retention.rb +1 -0
- data/lib/rm-extensions/version.rb +1 -1
- data/lib/rm-extensions.rb +0 -1
- metadata +9 -15
- data/ext/NSObject+RMExtensions.h +0 -161
- data/ext/NSObject+RMExtensions.m +0 -76
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9441b20b807881789ef429b6b7042149d260f0db
|
4
|
+
data.tar.gz: 824cd48ce0b752a627673149867344803538ec72
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9828f25a72edfc1b1fd69d293ab2c1592d8232df868d847defb83070e4bd8af54180b9a8d88880489124aa7dd4432ed805a3b1bbcdeba61ffdb1baf94c900120
|
7
|
+
data.tar.gz: 48be5fb1fa300464a5ebd40bcf32fb88c05907f0d4da32eb58aad034e9c8c12736bc588b2247184da0ade4e5f0e7139b32352219c2926e042c1849197567e901
|
data/README.md
CHANGED
data/lib/motion/retention.rb
CHANGED
data/lib/rm-extensions.rb
CHANGED
metadata
CHANGED
@@ -1,30 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rm-extensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.8
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Joe Noon
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-06-12 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bubble-wrap
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 1.1.5
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 1.1.5
|
30
27
|
description: Extensions and helpers for dealing with various areas of rubymotion
|
@@ -39,8 +36,6 @@ files:
|
|
39
36
|
- LICENSE.txt
|
40
37
|
- README.md
|
41
38
|
- Rakefile
|
42
|
-
- ext/NSObject+RMExtensions.h
|
43
|
-
- ext/NSObject+RMExtensions.m
|
44
39
|
- lib/motion/accessors.rb
|
45
40
|
- lib/motion/context.rb
|
46
41
|
- lib/motion/deallocation.rb
|
@@ -53,26 +48,25 @@ files:
|
|
53
48
|
- rm-extensions.gemspec
|
54
49
|
homepage: https://github.com/joenoon/rm-extensions
|
55
50
|
licenses: []
|
51
|
+
metadata: {}
|
56
52
|
post_install_message:
|
57
53
|
rdoc_options: []
|
58
54
|
require_paths:
|
59
55
|
- lib
|
60
56
|
required_ruby_version: !ruby/object:Gem::Requirement
|
61
|
-
none: false
|
62
57
|
requirements:
|
63
|
-
- -
|
58
|
+
- - '>='
|
64
59
|
- !ruby/object:Gem::Version
|
65
60
|
version: '0'
|
66
61
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
-
none: false
|
68
62
|
requirements:
|
69
|
-
- -
|
63
|
+
- - '>='
|
70
64
|
- !ruby/object:Gem::Version
|
71
65
|
version: '0'
|
72
66
|
requirements: []
|
73
67
|
rubyforge_project:
|
74
|
-
rubygems_version:
|
68
|
+
rubygems_version: 2.0.3
|
75
69
|
signing_key:
|
76
|
-
specification_version:
|
70
|
+
specification_version: 4
|
77
71
|
summary: Extensions and helpers for dealing with various areas of rubymotion
|
78
72
|
test_files: []
|
data/ext/NSObject+RMExtensions.h
DELETED
@@ -1,161 +0,0 @@
|
|
1
|
-
// This is a pull from BlocksKit, with modifications to accept an NSString,
|
2
|
-
// Since we can't send true unique pointers for objects from rubymotion, and
|
3
|
-
// we'll rely on sending Symbols from rubymotion which turn into unique strings
|
4
|
-
// in objective-c.
|
5
|
-
//
|
6
|
-
//
|
7
|
-
// NSObject+AssociatedObjects.h
|
8
|
-
// BlocksKit
|
9
|
-
//
|
10
|
-
|
11
|
-
/** Objective-C wrapper for 10.6+ associated object API.
|
12
|
-
|
13
|
-
In Mac OS X Snow Leopard and iOS 3.0, Apple introduced an addition to the
|
14
|
-
Objective-C Runtime called associated objects. Associated objects allow for the
|
15
|
-
pairing of a random key and object pair to be saved on an instance.
|
16
|
-
|
17
|
-
In BlocksKit, associated objects allow us to emulate instance variables in the
|
18
|
-
ategories we use.
|
19
|
-
|
20
|
-
Class methods also exist for each association. These associations are unique to
|
21
|
-
each class, and exist for the lifetime of the application unless set to `nil`.
|
22
|
-
Each class is a unique meta-object; the ultimate singleton.
|
23
|
-
|
24
|
-
Created by [Andy Matuschak](https://github.com/andymatuschak) as
|
25
|
-
`AMAssociatedObjects`.
|
26
|
-
*/
|
27
|
-
@interface NSObject (RMEXTAssociatedObjects)
|
28
|
-
|
29
|
-
/** Strongly associates an object with the reciever.
|
30
|
-
|
31
|
-
The associated value is retained as if it were a property
|
32
|
-
synthesized with `nonatomic` and `retain`.
|
33
|
-
|
34
|
-
Using retained association is strongly recommended for most
|
35
|
-
Objective-C object derivative of NSObject, particularly
|
36
|
-
when it is subject to being externally released or is in an
|
37
|
-
`NSAutoreleasePool`.
|
38
|
-
|
39
|
-
@param value Any object.
|
40
|
-
@param key A unique key pointer.
|
41
|
-
*/
|
42
|
-
- (void)rmext_associateValue:(id)value withKey:(NSString *)key;
|
43
|
-
|
44
|
-
/** Strongly associates an object with the receiving class.
|
45
|
-
|
46
|
-
@see associateValue:withKey:
|
47
|
-
@param value Any object.
|
48
|
-
@param key A unique key pointer.
|
49
|
-
*/
|
50
|
-
+ (void)rmext_associateValue:(id)value withKey:(NSString *)key;
|
51
|
-
|
52
|
-
/** Strongly, thread-safely associates an object with the reciever.
|
53
|
-
|
54
|
-
The associated value is retained as if it were a property
|
55
|
-
synthesized with `atomic` and `retain`.
|
56
|
-
|
57
|
-
Using retained association is strongly recommended for most
|
58
|
-
Objective-C object derivative of NSObject, particularly
|
59
|
-
when it is subject to being externally released or is in an
|
60
|
-
`NSAutoreleasePool`.
|
61
|
-
|
62
|
-
@see associateValue:withKey:
|
63
|
-
@param value Any object.
|
64
|
-
@param key A unique key pointer.
|
65
|
-
*/
|
66
|
-
- (void)rmext_atomicallyAssociateValue:(id)value withKey:(NSString *)key;
|
67
|
-
|
68
|
-
/** Strongly, thread-safely associates an object with the receiving class.
|
69
|
-
|
70
|
-
@see associateValue:withKey:
|
71
|
-
@param value Any object.
|
72
|
-
@param key A unique key pointer.
|
73
|
-
*/
|
74
|
-
+ (void)rmext_atomicallyAssociateValue:(id)value withKey:(NSString *)key;
|
75
|
-
|
76
|
-
/** Associates a copy of an object with the reciever.
|
77
|
-
|
78
|
-
The associated value is copied as if it were a property
|
79
|
-
synthesized with `nonatomic` and `copy`.
|
80
|
-
|
81
|
-
Using copied association is recommended for a block or
|
82
|
-
otherwise `NSCopying`-compliant instances like NSString.
|
83
|
-
|
84
|
-
@param value Any object, pointer, or value.
|
85
|
-
@param key A unique key pointer.
|
86
|
-
*/
|
87
|
-
- (void)rmext_associateCopyOfValue:(id)value withKey:(NSString *)key;
|
88
|
-
|
89
|
-
/** Associates a copy of an object with the receiving class.
|
90
|
-
|
91
|
-
@see associateCopyOfValue:withKey:
|
92
|
-
@param value Any object, pointer, or value.
|
93
|
-
@param key A unique key pointer.
|
94
|
-
*/
|
95
|
-
+ (void)rmext_associateCopyOfValue:(id)value withKey:(NSString *)key;
|
96
|
-
|
97
|
-
/** Thread-safely associates a copy of an object with the reciever.
|
98
|
-
|
99
|
-
The associated value is copied as if it were a property
|
100
|
-
synthesized with `atomic` and `copy`.
|
101
|
-
|
102
|
-
Using copied association is recommended for a block or
|
103
|
-
otherwise `NSCopying`-compliant instances like NSString.
|
104
|
-
|
105
|
-
@see associateCopyOfValue:withKey:
|
106
|
-
@param value Any object, pointer, or value.
|
107
|
-
@param key A unique key pointer.
|
108
|
-
*/
|
109
|
-
- (void)rmext_atomicallyAssociateCopyOfValue:(id)value withKey:(NSString *)key;
|
110
|
-
|
111
|
-
/** Thread-safely associates a copy of an object with the receiving class.
|
112
|
-
|
113
|
-
@see associateCopyOfValue:withKey:
|
114
|
-
@param value Any object, pointer, or value.
|
115
|
-
@param key A unique key pointer.
|
116
|
-
*/
|
117
|
-
+ (void)rmext_atomicallyAssociateCopyOfValue:(id)value withKey:(NSString *)key;
|
118
|
-
|
119
|
-
/** Weakly associates an object with the reciever.
|
120
|
-
|
121
|
-
A weak association will cause the pointer to be set to zero
|
122
|
-
or nil upon the disappearance of what it references;
|
123
|
-
in other words, the associated object is not kept alive.
|
124
|
-
|
125
|
-
@param value Any object.
|
126
|
-
@param key A unique key pointer.
|
127
|
-
*/
|
128
|
-
- (void)rmext_weaklyAssociateValue:(id)value withKey:(NSString *)key;
|
129
|
-
|
130
|
-
/** Weakly associates an object with the receiving class.
|
131
|
-
|
132
|
-
@see weaklyAssociateValue:withKey:
|
133
|
-
@param value Any object.
|
134
|
-
@param key A unique key pointer.
|
135
|
-
*/
|
136
|
-
+ (void)rmext_weaklyAssociateValue:(id)value withKey:(NSString *)key;
|
137
|
-
|
138
|
-
/** Returns the associated value for a key on the reciever.
|
139
|
-
|
140
|
-
@param key A unique key pointer.
|
141
|
-
@return The object associated with the key, or `nil` if not found.
|
142
|
-
*/
|
143
|
-
- (id)rmext_associatedValueForKey:(NSString *)key;
|
144
|
-
|
145
|
-
/** Returns the associated value for a key on the receiving class.
|
146
|
-
|
147
|
-
@see associatedValueForKey:
|
148
|
-
@param key A unique key pointer.
|
149
|
-
@return The object associated with the key, or `nil` if not found.
|
150
|
-
*/
|
151
|
-
+ (id)rmext_associatedValueForKey:(NSString *)key;
|
152
|
-
|
153
|
-
/** Returns the reciever to a clean state by removing all
|
154
|
-
associated objects, releasing them if necessary. */
|
155
|
-
- (void)rmext_removeAllAssociatedObjects;
|
156
|
-
|
157
|
-
/** Returns the recieving class to a clean state by removing
|
158
|
-
all associated objects, releasing them if necessary. */
|
159
|
-
+ (void)rmext_removeAllAssociatedObjects;
|
160
|
-
|
161
|
-
@end
|
data/ext/NSObject+RMExtensions.m
DELETED
@@ -1,76 +0,0 @@
|
|
1
|
-
// This is a pull from BlocksKit, with modifications to accept an NSString,
|
2
|
-
// Since we can't send true unique pointers for objects from rubymotion, and
|
3
|
-
// we'll rely on sending Symbols from rubymotion which turn into unique strings
|
4
|
-
// in objective-c.
|
5
|
-
//
|
6
|
-
//
|
7
|
-
// NSObject+AssociatedObjects.m
|
8
|
-
// BlocksKit
|
9
|
-
//
|
10
|
-
|
11
|
-
#import "NSObject+RMExtensions.h"
|
12
|
-
#import <objc/runtime.h>
|
13
|
-
|
14
|
-
@implementation NSObject (RMEXTAssociatedObjects)
|
15
|
-
|
16
|
-
#pragma mark - Instance Methods
|
17
|
-
|
18
|
-
- (void)rmext_associateValue:(id)value withKey:(NSString *)key {
|
19
|
-
objc_setAssociatedObject(self, key, value, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
20
|
-
}
|
21
|
-
|
22
|
-
- (void)rmext_atomicallyAssociateValue:(id)value withKey:(NSString *)key {
|
23
|
-
objc_setAssociatedObject(self, key, value, OBJC_ASSOCIATION_RETAIN);
|
24
|
-
}
|
25
|
-
|
26
|
-
- (void)rmext_associateCopyOfValue:(id)value withKey:(NSString *)key {
|
27
|
-
objc_setAssociatedObject(self, key, value, OBJC_ASSOCIATION_COPY_NONATOMIC);
|
28
|
-
}
|
29
|
-
|
30
|
-
- (void)rmext_atomicallyAssociateCopyOfValue:(id)value withKey:(NSString *)key {
|
31
|
-
objc_setAssociatedObject(self, key, value, OBJC_ASSOCIATION_COPY);
|
32
|
-
}
|
33
|
-
|
34
|
-
- (void)rmext_weaklyAssociateValue:(id)value withKey:(NSString *)key {
|
35
|
-
objc_setAssociatedObject(self, key, value, OBJC_ASSOCIATION_ASSIGN);
|
36
|
-
}
|
37
|
-
|
38
|
-
- (id)rmext_associatedValueForKey:(NSString *)key {
|
39
|
-
return objc_getAssociatedObject(self, key);
|
40
|
-
}
|
41
|
-
|
42
|
-
- (void)rmext_removeAllAssociatedObjects {
|
43
|
-
objc_removeAssociatedObjects(self);
|
44
|
-
}
|
45
|
-
|
46
|
-
#pragma mark - Class Methods
|
47
|
-
|
48
|
-
+ (void)rmext_associateValue:(id)value withKey:(NSString *)key {
|
49
|
-
objc_setAssociatedObject(self, key, value, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
|
50
|
-
}
|
51
|
-
|
52
|
-
+ (void)rmext_atomicallyAssociateValue:(id)value withKey:(NSString *)key {
|
53
|
-
objc_setAssociatedObject(self, key, value, OBJC_ASSOCIATION_RETAIN);
|
54
|
-
}
|
55
|
-
|
56
|
-
+ (void)rmext_associateCopyOfValue:(id)value withKey:(NSString *)key {
|
57
|
-
objc_setAssociatedObject(self, key, value, OBJC_ASSOCIATION_COPY_NONATOMIC);
|
58
|
-
}
|
59
|
-
|
60
|
-
+ (void)rmext_atomicallyAssociateCopyOfValue:(id)value withKey:(NSString *)key {
|
61
|
-
objc_setAssociatedObject(self, key, value, OBJC_ASSOCIATION_COPY);
|
62
|
-
}
|
63
|
-
|
64
|
-
+ (void)rmext_weaklyAssociateValue:(id)value withKey:(NSString *)key {
|
65
|
-
objc_setAssociatedObject(self, key, value, OBJC_ASSOCIATION_ASSIGN);
|
66
|
-
}
|
67
|
-
|
68
|
-
+ (id)rmext_associatedValueForKey:(NSString *)key {
|
69
|
-
return objc_getAssociatedObject(self, key);
|
70
|
-
}
|
71
|
-
|
72
|
-
+ (void)rmext_removeAllAssociatedObjects {
|
73
|
-
objc_removeAssociatedObjects(self);
|
74
|
-
}
|
75
|
-
|
76
|
-
@end
|