Method: Parsistence::Query#fetchAll

Defined in:
lib/Parsistence/Query.rb

#fetchAll(&callback) ⇒ Nil

Deprecated.

Grab all results that match query

(see #all)

Parameters:

  • callback (Block)

    block

Returns:

  • (Nil)


196
197
198
199
200
201
202
203
204
205
206
207
208
# File 'lib/Parsistence/Query.rb', line 196

def fetchAll(&callback)
  query = createQuery

  myKlass = self.klass
  query.findObjectsInBackgroundWithBlock (->(items) {
    modelItems = []
    modelItems = items.map! { |item| myKlass.new(item) } if items
    callback.call(modelItems)         if callback.arity == 1
    callback.call                     if callback.arity == 0
  })

  self
end