Method: Parsistence::Query#count

Defined in:
lib/Parsistence/Query.rb

#count(&callback) ⇒ Object



165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/Parsistence/Query.rb', line 165

def count(&callback)
  query = createQuery
  error = Pointer.new(:object)
  query.countObjectsInBackgroundWithBlock lambda { |item_count, error|
    if error
      callback.call false
    else
      callback.call item_count
    end
  }

  self
end