rm-extensions 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/motion/observation.rb +24 -25
- data/lib/rm-extensions/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7edd41307de1d5c1e865bbb76ea316389c1a2712
|
4
|
+
data.tar.gz: 382ea7eb32aca95c7d872f948511806d8651bc0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e407a9a1676903d3b5e0b87278667257bfba115b54ea7d10e9c83fe05659f868be16fcd25bd582c05b5fd685e6fe4d3779b703f4657accc215697d2f464038df
|
7
|
+
data.tar.gz: 4e201aceefe215907ef2b7c1a25fd34d2ffb8d2167735547dfd38fd2e0e03b8b2937388a9446890d95f384bb794229cfea44b6c59d9b4a43ba7cde5c1597de1e
|
data/lib/motion/observation.rb
CHANGED
@@ -104,9 +104,6 @@ module RMExtensions
|
|
104
104
|
end
|
105
105
|
|
106
106
|
def cleanup
|
107
|
-
if ::RMExtensions.debug?
|
108
|
-
p "cleanup ObservationProxy(#{@desc})"
|
109
|
-
end
|
110
107
|
unobserve_all
|
111
108
|
off_all
|
112
109
|
true
|
@@ -154,17 +151,18 @@ module RMExtensions
|
|
154
151
|
key_path = key_path.to_s
|
155
152
|
@targets[target] ||= {}
|
156
153
|
@targets[target][key_path] ||= []
|
154
|
+
block.weak!
|
157
155
|
@targets[target][key_path].addObject block
|
158
156
|
end
|
159
157
|
|
160
158
|
# NSKeyValueObserving Protocol
|
161
159
|
|
162
160
|
def observeValueForKeyPath(key_path, ofObject:target, change:change, context:context)
|
163
|
-
m_desc = nil
|
164
|
-
if ::RMExtensions.debug?
|
165
|
-
|
166
|
-
|
167
|
-
end
|
161
|
+
# m_desc = nil
|
162
|
+
# if ::RMExtensions.debug?
|
163
|
+
# m_desc = "~~> ObservationProxy(#{@desc})#observeValueForKeyPath(#{key_path}, ofObject:#{target.inspect.split(" ").first}>, ...)"
|
164
|
+
# p "called", m_desc
|
165
|
+
# end
|
168
166
|
action = proc do
|
169
167
|
next if @did_dealloc
|
170
168
|
next if target.nil?
|
@@ -173,9 +171,9 @@ module RMExtensions
|
|
173
171
|
blocks = key_paths[key_path]
|
174
172
|
next if blocks.nil?
|
175
173
|
blocks = [] + blocks # get a new array that can be popped
|
176
|
-
if ::RMExtensions.debug?
|
177
|
-
|
178
|
-
end
|
174
|
+
# if ::RMExtensions.debug?
|
175
|
+
# p "blocks.size", blocks.size, m_desc
|
176
|
+
# end
|
179
177
|
while blk = blocks.pop
|
180
178
|
res = ObservationResponse.new
|
181
179
|
res.context = @weak_object
|
@@ -189,14 +187,14 @@ module RMExtensions
|
|
189
187
|
end
|
190
188
|
end
|
191
189
|
if NSThread.currentThread.isMainThread
|
192
|
-
if ::RMExtensions.debug?
|
193
|
-
|
194
|
-
end
|
190
|
+
# if ::RMExtensions.debug?
|
191
|
+
# p "inline execution", m_desc
|
192
|
+
# end
|
195
193
|
action.call
|
196
194
|
else
|
197
|
-
if ::RMExtensions.debug?
|
198
|
-
|
199
|
-
end
|
195
|
+
# if ::RMExtensions.debug?
|
196
|
+
# p "dispatch execution", m_desc
|
197
|
+
# end
|
200
198
|
rmext_on_main_q(&action)
|
201
199
|
end
|
202
200
|
end
|
@@ -213,6 +211,7 @@ module RMExtensions
|
|
213
211
|
context_event_blocks = []
|
214
212
|
context_events.setObject(context_event_blocks, forKey:event)
|
215
213
|
end
|
214
|
+
block.weak!
|
216
215
|
context_event_blocks.addObject block
|
217
216
|
end
|
218
217
|
|
@@ -231,11 +230,11 @@ module RMExtensions
|
|
231
230
|
end
|
232
231
|
|
233
232
|
def trigger(event, value)
|
234
|
-
m_desc = nil
|
235
|
-
if ::RMExtensions.debug?
|
236
|
-
|
237
|
-
|
238
|
-
end
|
233
|
+
# m_desc = nil
|
234
|
+
# if ::RMExtensions.debug?
|
235
|
+
# m_desc = "~~> ObservationProxy(#{@desc})#trigger(#{event}, #{value.inspect.split(" ").first }>)"
|
236
|
+
# p "called", m_desc
|
237
|
+
# end
|
239
238
|
rmext_on_main_q do
|
240
239
|
next if @did_dealloc
|
241
240
|
next if event.nil?
|
@@ -249,9 +248,9 @@ module RMExtensions
|
|
249
248
|
if context_events = @events.objectForKey(context)
|
250
249
|
if event_blocks = context_events[event]
|
251
250
|
blocks = [] + event_blocks
|
252
|
-
if ::RMExtensions.debug?
|
253
|
-
|
254
|
-
end
|
251
|
+
# if ::RMExtensions.debug?
|
252
|
+
# p "blocks.size", blocks.size, m_desc
|
253
|
+
# end
|
255
254
|
while blk = blocks.pop
|
256
255
|
res = EventResponse.new
|
257
256
|
res.context = context
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rm-extensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Noon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Extensions and helpers for dealing with various areas of rubymotion
|
14
14
|
email:
|