Parsistence 0.3.20 → 0.3.21

Sign up to get free protection for your applications and to get access to all the features.
@@ -172,6 +172,8 @@ module Parsistence
172
172
  callback.call item_count
173
173
  end
174
174
  }
175
+
176
+ self
175
177
  end
176
178
 
177
179
  def fetch(&callback)
@@ -196,9 +198,14 @@ module Parsistence
196
198
 
197
199
  myKlass = self.klass
198
200
  query.findObjectsInBackgroundWithBlock (lambda { |items, error|
201
+ modelItems = []
199
202
  modelItems = items.map! { |item| myKlass.new(item) } if items
200
- callback.call modelItems, error
203
+ callback.call(modelItems, error) if callback.arity == 2
204
+ callback.call(modelItems) if callback.arity == 1
205
+ callback.call if callback.arity == 0
201
206
  })
207
+
208
+ self
202
209
  end
203
210
 
204
211
  # @deprecated
@@ -215,8 +222,12 @@ module Parsistence
215
222
  myKlass = self.klass
216
223
  query.getFirstObjectInBackgroundWithBlock (lambda { |item, error|
217
224
  modelItem = myKlass.new(item) if item
218
- callback.call modelItem, error
225
+ callback.call(modelItem, error) if callback.arity == 2
226
+ callback.call(modelItem) if callback.arity == 1
227
+ callback.call if callback.arity == 0
219
228
  })
229
+
230
+ self
220
231
  end
221
232
 
222
233
  # @deprecated
@@ -1,3 +1,3 @@
1
1
  module Parsistence
2
- VERSION = "0.3.20" unless defined? Parsistence::VERSION
2
+ VERSION = "0.3.21" unless defined? Parsistence::VERSION
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Parsistence
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.20
4
+ version: 0.3.21
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-12-03 00:00:00.000000000 Z
13
+ date: 2013-01-08 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: Your models on RubyMotion and Parse in a persistence.js style pattern.
16
16
  email: