rm-extensions 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/motion/accessors.rb +2 -17
- data/lib/motion/retention.rb +8 -4
- data/lib/rm-extensions/version.rb +1 -1
- metadata +2 -2
data/lib/motion/accessors.rb
CHANGED
@@ -12,25 +12,10 @@ module RMExtensions
|
|
12
12
|
def rmext_weak_attr_accessor(*attrs)
|
13
13
|
attrs.each do |attr|
|
14
14
|
define_method(attr) do
|
15
|
-
|
15
|
+
instance_variable_get("@#{attr}")
|
16
16
|
end
|
17
17
|
define_method("#{attr}=") do |val|
|
18
|
-
|
19
|
-
val
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
# creates an +attr_accessor+ like behavior, but the objects are stored with
|
25
|
-
# OBJC_ASSOCIATION_COPY.
|
26
|
-
# does not conform to KVO like attr_accessor does.
|
27
|
-
def rmext_copy_attr_accessor(*attrs)
|
28
|
-
attrs.each do |attr|
|
29
|
-
define_method(attr) do
|
30
|
-
rmext_associatedValueForKey(attr.to_sym)
|
31
|
-
end
|
32
|
-
define_method("#{attr}=") do |val|
|
33
|
-
rmext_atomicallyAssociateCopyOfValue(val, withKey: attr.to_sym)
|
18
|
+
instance_variable_set("@#{attr}", WeakRef.new(val))
|
34
19
|
val
|
35
20
|
end
|
36
21
|
end
|
data/lib/motion/retention.rb
CHANGED
@@ -2,15 +2,19 @@ module RMExtensions
|
|
2
2
|
|
3
3
|
# A retained array, which will hold other objects we want retained.
|
4
4
|
def self.retained_items
|
5
|
-
Dispatch.once { @retained_items = [] }
|
6
|
-
@retained_items
|
5
|
+
# Dispatch.once { @retained_items = [] }
|
6
|
+
# @retained_items
|
7
|
+
# FIXME: http://hipbyte.myjetbrains.com/youtrack/issue/RM-134
|
8
|
+
@retained_items ||= []
|
7
9
|
end
|
8
10
|
|
9
11
|
# A serial queue to perform all retain/detach operations on, to ensure we are always modifying
|
10
12
|
# +retained_items+ on the same thread.
|
11
13
|
def self.retains_queue
|
12
|
-
Dispatch.once { @retains_queue = Dispatch::Queue.new("#{NSBundle.mainBundle.bundleIdentifier}.rmext_retains_queue") }
|
13
|
-
@retains_queue
|
14
|
+
# Dispatch.once { @retains_queue = Dispatch::Queue.new("#{NSBundle.mainBundle.bundleIdentifier}.rmext_retains_queue") }
|
15
|
+
# @retains_queue
|
16
|
+
# FIXME: http://hipbyte.myjetbrains.com/youtrack/issue/RM-134
|
17
|
+
@retains_queue ||= Dispatch::Queue.new("#{NSBundle.mainBundle.bundleIdentifier}.rmext_retains_queue")
|
14
18
|
end
|
15
19
|
|
16
20
|
module ObjectExtensions
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rm-extensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bubble-wrap
|