Sha256: 0a179e35463a56103591a2fd10cbf342fdd56894793bbce77d644df50cd62b1c

Contents?: true

Size: 781 Bytes

Versions: 6

Compression:

Stored size: 781 Bytes

Contents

# frozen_string_literal: true

module Trifle
  module Stats
    module Operations
      module Timeseries
        class Increment
          attr_reader :key, :values

          def initialize(**keywords)
            @key = keywords.fetch(:key)
            @at = keywords.fetch(:at)
            @values = keywords.fetch(:values)
            @config = keywords[:config]
          end

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

          def perform
            config.ranges.map do |range|
              at = Nocturnal.new(@at, config: config).send(range)
              config.driver.inc(
                key: [key, range, at.to_i],
                **values
              )
            end
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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