Sha256: be0ae09403a1c6dc8f077cd2cd6816de31d2227d342770c55ef96191e51d3538

Contents?: true

Size: 542 Bytes

Versions: 3

Compression:

Stored size: 542 Bytes

Contents

require 'singleton'
require 'rails_autoscale_agent/time_rounder'
require 'rails_autoscale_agent/measurement'
require 'rails_autoscale_agent/report'

module RailsAutoscaleAgent
  class Store
    include Singleton

    def initialize
      @measurements = []
    end

    def push(value, time = Time.now)
      @measurements << Measurement.new(time, value)
    end

    def pop_report
      report = Report.new

      while measurement = @measurements.shift
        report.measurements << measurement
      end

      report
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails_autoscale_agent-0.3.1 lib/rails_autoscale_agent/store.rb
rails_autoscale_agent-0.3.0 lib/rails_autoscale_agent/store.rb
rails_autoscale_agent-0.2.0 lib/rails_autoscale_agent/store.rb