Sha256: 658682a9bdae6bd09117d70f5f5c3fa7a45a4de79d803cadb4887792720095c3

Contents?: true

Size: 518 Bytes

Versions: 9

Compression:

Stored size: 518 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
          data << metric.aggregate.apply(scope.where("#{metric.group_by} < ?", start_time))
        end
      end

      data
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
prosperity-0.0.10 lib/prosperity/extractors/total.rb
prosperity-0.0.9 lib/prosperity/extractors/total.rb
prosperity-0.0.8 lib/prosperity/extractors/total.rb
prosperity-0.0.7 lib/prosperity/extractors/total.rb
prosperity-0.0.6 lib/prosperity/extractors/total.rb
prosperity-0.0.5 lib/prosperity/extractors/total.rb
prosperity-0.0.4 lib/prosperity/extractors/total.rb
prosperity-0.0.3 lib/prosperity/extractors/total.rb
prosperity-0.0.2 lib/prosperity/extractors/total.rb