Method: Parse::Query#results
- Defined in:
- lib/parse/query.rb
#results(raw: false) { ... } ⇒ Array<Hash>, Array<Parse::Object> Also known as: result
Executes the query and builds the result set of Parse::Objects that matched. When this method is passed a block, the block is yielded for each matching item in the result, and the items are not returned. This methodology is more performant as large quantifies of objects are fetched in batches and all of them do not have to be kept in memory after the query finishes executing. This is the recommended method of processing large result sets.
799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 |
# File 'lib/parse/query.rb', line 799 def results(raw: false) if @results.nil? if block_given? max_results(raw: raw, &Proc.new) elsif @limit.is_a?(Numeric) response = fetch!(compile) return [] if response.error? items = raw ? response.results : decode(response.results) return items.each(&Proc.new) if block_given? @results = items else @results = max_results(raw: raw) end end @results end |