Sha256: c7796fd89f92a75c9e10c4fc67315cf185b1256d8e17f2b8a760190cd44a56bf

Contents?: true

Size: 534 Bytes

Versions: 1

Compression:

Stored size: 534 Bytes

Contents

module Prosperity
  class Extractors::Total < Extractors::Base
    def self.key
      "total"
    end

    def to_a
      data = []

      period.each_period(start_time, end_time) do |start_time|
        if metric.sql?
          data << count_up_to_date_with_sql(start_time)
        elsif metric.ruby?
          data << metric.value_at.call(start_time, period)
        else
          s = scope.where("#{metric.group_by} < ?", start_time)
          data << metric.aggregate.apply(s)
        end
      end

      data
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
prosperity-0.0.11 lib/prosperity/extractors/total.rb