aggregate (DataMapper::Adapters::DataObjectsAdapter)

    # File lib/dm-aggregates/adapters/data_objects_adapter.rb, line 4
          def aggregate(query)
            with_reader(read_statement(query), query.bind_values) do |reader|
              results = []

              while(reader.next!) do
                row = query.fields.zip(reader.values).map do |field,value|
                  if field.respond_to?(:operator)
                    send(field.operator, field.target, value)
                  else
                    field.typecast(value)
                  end
                end

                results << (query.fields.size > 1 ? row : row[0])
              end

              results
            end
          end