Sha256: fde391d2dd7d3f90c9c843d9c6a1ba26fba99f8a14659608086aaa94015ed5c7

Contents?: true

Size: 866 Bytes

Versions: 5

Compression:

Stored size: 866 Bytes

Contents

# frozen_string_literal: true

module Trifle
  module Stats
    module Operations
      module Timeseries
        class Values
          attr_reader :key, :range

          def initialize(**keywords)
            @key = keywords.fetch(:key)
            @from = keywords.fetch(:from)
            @to = keywords.fetch(:to)
            @range = keywords.fetch(:range)
            @config = keywords[:config]
          end

          def config
            @config || Trifle::Stats.default
          end

          def timeline
            Nocturnal.timeline(from: @from, to: @to, range: range)
          end

          def perform
            timeline.map do |at|
              {
                at => config.driver.get(
                  key: [key, range, at.to_i]
                )
              }
            end
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
trifle-stats-0.4.1 lib/trifle/stats/operations/timeseries/values.rb
trifle-stats-0.4.0 lib/trifle/stats/operations/timeseries/values.rb
trifle-stats-0.3.2 lib/trifle/stats/operations/timeseries/values.rb
trifle-stats-0.3.1 lib/trifle/stats/operations/timeseries/values.rb
trifle-stats-0.3.0 lib/trifle/stats/operations/timeseries/values.rb