Class: Parse::SortableGroupByDate

Inherits:
GroupByDate show all
Defined in:
lib/parse/query.rb

Overview

Sortable version of GroupByDate that returns GroupedResult objects instead of plain hashes. Provides the same aggregation methods but with sorting capabilities.

Instance Method Summary collapse

Methods inherited from GroupByDate

#initialize, #order, #pipeline, #sort

Constructor Details

This class inherits a constructor from Parse::GroupByDate

Instance Method Details

#average(field) ⇒ GroupedResult Also known as: avg

Calculate average of a field for each time period.

Parameters:

  • field (Symbol, String)

    the field to average within each time period.

Returns:



7108
7109
7110
7111
# File 'lib/parse/query.rb', line 7108

def average(field)
  results = super
  GroupedResult.new(results)
end

#countGroupedResult

Count the number of items in each time period.

Returns:



7092
7093
7094
7095
# File 'lib/parse/query.rb', line 7092

def count
  results = super
  GroupedResult.new(results)
end

#max(field) ⇒ GroupedResult

Find maximum value of a field for each time period.

Parameters:

  • field (Symbol, String)

    the field to find maximum for within each time period.

Returns:



7126
7127
7128
7129
# File 'lib/parse/query.rb', line 7126

def max(field)
  results = super
  GroupedResult.new(results)
end

#min(field) ⇒ GroupedResult

Find minimum value of a field for each time period.

Parameters:

  • field (Symbol, String)

    the field to find minimum for within each time period.

Returns:



7118
7119
7120
7121
# File 'lib/parse/query.rb', line 7118

def min(field)
  results = super
  GroupedResult.new(results)
end

#sum(field) ⇒ GroupedResult

Sum a field for each time period.

Parameters:

  • field (Symbol, String)

    the field to sum within each time period.

Returns:



7100
7101
7102
7103
# File 'lib/parse/query.rb', line 7100

def sum(field)
  results = super
  GroupedResult.new(results)
end